fix 修改邮箱授权码为非必填后的bug
This commit is contained in:
+11
-5
@@ -376,12 +376,14 @@ public class SysUserController {
|
||||
baseCommonService.addLog("编辑用户,用户账号:" + sysUser.getUsername(), CommonConstant.LOG_TYPE_2, CommonConstant.OPERATE_TYPE_3);
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
String email;
|
||||
String emailPassword;
|
||||
String emailPassword = user.getEmailPassword();
|
||||
String phone;
|
||||
try {
|
||||
//1:先用私钥解密数据
|
||||
email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
emailPassword = CommonUtils.decryptBtRsaPriKey(user.getEmailPassword(), rsaPrivateKey);
|
||||
if (StringUtils.isNotBlank(emailPassword)){
|
||||
emailPassword = CommonUtils.decryptBtRsaPriKey(emailPassword, rsaPrivateKey);
|
||||
}
|
||||
phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("解密失败!",e);
|
||||
@@ -394,11 +396,13 @@ public class SysUserController {
|
||||
ValidUtil.validate(user);
|
||||
//3:把数据加密在放回来
|
||||
email = PasswordUtil.encrypt(email);
|
||||
emailPassword = PasswordUtil.encrypt(emailPassword);
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setEmailPassword(emailPassword);
|
||||
user.setPhone(phone);
|
||||
if (StringUtils.isNotBlank(emailPassword)){
|
||||
emailPassword = PasswordUtil.encrypt(emailPassword);
|
||||
user.setEmailPassword(emailPassword);
|
||||
}
|
||||
if (ADMIN_USER.contains(StringUtils.lowerCase(user.getUsername().trim()))) {
|
||||
throw new JeroBootException("不可添加用户名为admin,root,test,administrator,supervisor的用户");
|
||||
}
|
||||
@@ -766,7 +770,9 @@ public class SysUserController {
|
||||
params.setNeedSave(true);
|
||||
//导入Excel格式校验,看匹配的字段文本概率
|
||||
Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), SysUserTemplate.class, params,1.0);
|
||||
if(!t){
|
||||
if (t == null){
|
||||
return Result.error("文件导入失败: 导入数据为空");
|
||||
} else if(!t){
|
||||
return Result.error("文件格式有误,请下载模板后上传 !");
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user