Commit a165e65f authored by R10's avatar R10

登录修改

parent 1960b66a
package com.tools.common.util;
import org.springframework.beans.factory.annotation.Value;
import java.util.UUID;
/**
*/
public class PasswordUtils {
@Value("${pwd.decrypt.key}")
public String key;
@Value("${pwd.decrypt.iv}")
private String iv;
/**
* 匹配密码
* @param salt 盐
......@@ -36,6 +27,10 @@ public class PasswordUtils {
return new PasswordEncoder(salt).encode(rawPass);
}
public static void main(String[] args) {
System.out.println(encode("111111","fcC0G17468ca0"));
}
/**
* 获取加密盐
* @return
......
......@@ -53,9 +53,10 @@ public class LoginController {
return Result.error("账号或密码错误,请重新输入");
}
//解前端给回来的密码
String decryptPwd = PasswordUtils.encode(salt, pwdUtils.decryptPassword(password));
String originPwd = pwdUtils.decryptPassword(password);
String decryptPwd = PasswordUtils.encode(originPwd, salt);
if (PasswordUtils.matches(salt, decryptPwd, user.getPassword())) {
if (PasswordUtils.matches(salt, originPwd, decryptPwd)) {
StpUtil.login(user.getUserId());
} else {
return Result.error("账号或密码错误,请重新输入");
......
......@@ -43,19 +43,10 @@ public class CutControllerTest {
sysUser.setStatus("");
sysUser.setOrgId(0L);
sysUser.setRemark("");
sysUser.setUserIdCreate(0L);
sysUser.setCreatedTime(new Timestamp(new java.util.Date().getTime()));
sysUser.setModifiedTime(new Timestamp(new java.util.Date().getTime()));
sysUser.setIsModifyPwd((short) 0);
sysUser.setOrgName("");
sysUser.setRoleIdList(Lists.newArrayList());
sysUser.setRoleNameList(Lists.newArrayList());
sysUser.setIsDeleted("");
sysUser.setPageData(Lists.newArrayList());
sysUser.setPageSize(0);
sysUser.setTotalCount(0L);
sysUser.setPageNo(0);
sysUser.setDescription("");
sysUserService.save(sysUser);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment