diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java
index 97dfd1022..8cb61701d 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java
@@ -6,6 +6,7 @@ import org.springframework.util.StringUtils;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.manager.AsyncManager;
@@ -33,13 +34,13 @@ public class SysRegisterService
*/
public String register(SysUser user)
{
- String msg = "", username = user.getLoginName(), password = user.getPassword();
+ String msg = "", loginName = user.getLoginName(), password = user.getPassword();
if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA)))
{
msg = "验证码错误";
}
- else if (StringUtils.isEmpty(username))
+ else if (StringUtils.isEmpty(loginName))
{
msg = "用户名不能为空";
}
@@ -52,17 +53,19 @@ public class SysRegisterService
{
msg = "密码长度必须在5到20个字符之间";
}
- else if (username.length() < UserConstants.USERNAME_MIN_LENGTH
- || username.length() > UserConstants.USERNAME_MAX_LENGTH)
+ else if (loginName.length() < UserConstants.USERNAME_MIN_LENGTH
+ || loginName.length() > UserConstants.USERNAME_MAX_LENGTH)
{
msg = "账户长度必须在2到20个字符之间";
}
- else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(username)))
+ else if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(loginName)))
{
- msg = "保存用户'" + username + "'失败,注册账号已存在";
+ msg = "保存用户'" + loginName + "'失败,注册账号已存在";
}
else
{
+ user.setPwdUpdateDate(DateUtils.getNowDate());
+ user.setUserName(loginName);
user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
boolean regFlag = userService.registerUser(user);
@@ -72,7 +75,7 @@ public class SysRegisterService
}
else
{
- AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success")));
+ AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.REGISTER, MessageUtils.message("user.register.success")));
}
}
return msg;
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 7f1c18497..1ee58e8fa 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -200,6 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
password,
salt,
status,
+ pwd_update_date,
create_by,
remark,
create_time
@@ -216,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{password},
#{salt},
#{status},
+ #{pwdUpdateDate},
#{createBy},
#{remark},
sysdate()