新增用户名时候密码 增加MD5加密

pull/1/head
Administrator 2020-03-24 23:49:24 +08:00
parent 079f76ed40
commit 7ee97bc688
3 changed files with 9 additions and 5 deletions

View File

@ -102,8 +102,8 @@ public class SysLoginController {
logger.error("登录失败次数过多", e); logger.error("登录失败次数过多", e);
return Result.failure("登录失败次数过多"); return Result.failure("登录失败次数过多");
} catch (IncorrectCredentialsException e) { } catch (IncorrectCredentialsException e) {
logger.error("错误的凭证", e); logger.error("密码错误", e);
return Result.failure("错误的凭证"); return Result.failure("密码错误");
} catch (ExpiredCredentialsException e) { } catch (ExpiredCredentialsException e) {
logger.error("过期的凭证", e); logger.error("过期的凭证", e);
return Result.failure("过期的凭证"); return Result.failure("过期的凭证");

View File

@ -62,7 +62,7 @@ public class SysUser extends BaseEntity {
/** /**
* *
*/ */
private LocalDateTime birthday; private String birthday;
/** /**
* idsys_fileid * idsys_fileid
@ -179,11 +179,11 @@ public class SysUser extends BaseEntity {
this.sex = sex; this.sex = sex;
} }
public LocalDateTime getBirthday() { public String getBirthday() {
return birthday; return birthday;
} }
public void setBirthday(LocalDateTime birthday) { public void setBirthday(String birthday) {
this.birthday = birthday; this.birthday = birthday;
} }

View File

@ -10,6 +10,7 @@ import com.wangziyang.mes.system.service.ISysMenuService;
import com.wangziyang.mes.system.service.ISysRoleService; import com.wangziyang.mes.system.service.ISysRoleService;
import com.wangziyang.mes.system.service.ISysUserService; import com.wangziyang.mes.system.service.ISysUserService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -45,6 +46,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void save(SysUserDTO record) throws Exception { 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); sysUserMapper.insert(record);
sysRoleService.rebuild(record); sysRoleService.rebuild(record);
} }