|
@@ -292,4 +292,19 @@ public class LoginService {
|
|
}
|
|
}
|
|
return userService.registerBatch(paramList);
|
|
return userService.registerBatch(paramList);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void changePwd(JSONObject param,String token) {
|
|
|
|
+ String oldPassword = param.getString("oldPassword");
|
|
|
|
+ String newPassword = param.getString("newPassword");
|
|
|
|
+ User user = userService.getByToken(token);
|
|
|
|
+ if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(newPassword)){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
|
|
|
|
+ }
|
|
|
|
+ //正则判断密码是否符合规则(8位以上并且数字英文组合)
|
|
|
|
+ if(!newPassword.matches(ConstantRegex.PASSWORD_REGEX)){
|
|
|
|
+ throw new BusinessException(LoginConstant.FAILURE_CODE_3011, LoginConstant.FAILURE_MSG_3011);
|
|
|
|
+ }
|
|
|
|
+ String pwdMd5 = SecurityUtil.MD5(newPassword);
|
|
|
|
+ userService.updatePassword(user.getUserName(), pwdMd5);
|
|
|
|
+ }
|
|
}
|
|
}
|