Commit 65bf7039 authored by 技术部-任文超's avatar 技术部-任文超

变更:

1、不允许空密码用户通过账密登陆
2、无密码注册不再设置默认密码
parent 5ab5e81d
...@@ -480,8 +480,19 @@ public class UserController implements IBaseController { ...@@ -480,8 +480,19 @@ public class UserController implements IBaseController {
return user; return user;
} }
/**
* 账密登陆
*
* @param paramPass 不允许空密码
* @param targetPassword
* @return
*/
private boolean validatePassword(String paramPass, String targetPassword) { private boolean validatePassword(String paramPass, String targetPassword) {
return StringUtils.defaultString(targetPassword, "").equals(PasswordUtil.MD5(paramPass.toLowerCase() + Constants.PASSWORD_SALT)); if(StringUtils.isBlank(paramPass)){
return false;
}
String thePassword = PasswordUtil.MD5(paramPass.toLowerCase() + Constants.PASSWORD_SALT);
return Objects.equals(thePassword, targetPassword);
} }
private JsonResult loginWithUserId(Long channelId, String appChannel, Long createdFrom, String userId, Merchant merchant, String dimension, HttpServletRequest request) { private JsonResult loginWithUserId(Long channelId, String appChannel, Long createdFrom, String userId, Merchant merchant, String dimension, HttpServletRequest request) {
......
...@@ -74,7 +74,9 @@ public class UserRegisterServiceImpl implements IUserRegisterService { ...@@ -74,7 +74,9 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
if (userRegisterParam.isGenerateRandomPwd()) { if (userRegisterParam.isGenerateRandomPwd()) {
password = PasswordUtil.generateRandomPwd(Constants.RANDOM_PWD_LEN); password = PasswordUtil.generateRandomPwd(Constants.RANDOM_PWD_LEN);
} }
user.setPassword(PasswordUtil.MD5(password.toLowerCase() + Constants.PASSWORD_SALT)); if(StringUtils.isNotBlank(password)){
user.setPassword(PasswordUtil.MD5WithSalt(password));
}
Timestamp currentTime = new Timestamp(System.currentTimeMillis()); Timestamp currentTime = new Timestamp(System.currentTimeMillis());
user.setUpdatedAt(currentTime); user.setUpdatedAt(currentTime);
user.setCreatedAt(currentTime); user.setCreatedAt(currentTime);
......
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