新增用户名时候密码 增加MD5加密
parent
079f76ed40
commit
7ee97bc688
|
@ -102,8 +102,8 @@ public class SysLoginController {
|
|||
logger.error("登录失败次数过多", e);
|
||||
return Result.failure("登录失败次数过多");
|
||||
} catch (IncorrectCredentialsException e) {
|
||||
logger.error("错误的凭证", e);
|
||||
return Result.failure("错误的凭证");
|
||||
logger.error("密码错误", e);
|
||||
return Result.failure("密码错误");
|
||||
} catch (ExpiredCredentialsException e) {
|
||||
logger.error("过期的凭证", e);
|
||||
return Result.failure("过期的凭证");
|
||||
|
|
|
@ -62,7 +62,7 @@ public class SysUser extends BaseEntity {
|
|||
/**
|
||||
* 出生年月日
|
||||
*/
|
||||
private LocalDateTime birthday;
|
||||
private String birthday;
|
||||
|
||||
/**
|
||||
* 图片id,对应sys_file表中的id
|
||||
|
@ -179,11 +179,11 @@ public class SysUser extends BaseEntity {
|
|||
this.sex = sex;
|
||||
}
|
||||
|
||||
public LocalDateTime getBirthday() {
|
||||
public String getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(LocalDateTime birthday) {
|
||||
public void setBirthday(String birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.wangziyang.mes.system.service.ISysMenuService;
|
|||
import com.wangziyang.mes.system.service.ISysRoleService;
|
||||
import com.wangziyang.mes.system.service.ISysUserService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.shiro.crypto.hash.Md5Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -45,6 +46,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(SysUserDTO record) throws Exception {
|
||||
//MD5算法计算3次
|
||||
String result = new Md5Hash(record.getPassword(), record.getUsername(),3).toString();
|
||||
record.setPassword(result);
|
||||
sysUserMapper.insert(record);
|
||||
sysRoleService.rebuild(record);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue