Md5加密登录
This commit is contained in:
parent
00b26569ff
commit
7b0bd0e175
|
@ -30,21 +30,20 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|||
* @return Employee
|
||||
*/
|
||||
public Employee login(EmployeeLoginDTO employeeLoginDTO) {
|
||||
|
||||
String username = employeeLoginDTO.getUsername();
|
||||
String password = employeeLoginDTO.getPassword();
|
||||
|
||||
//1、根据用户名查询数据库中的数据
|
||||
// 1、根据用户名查询数据库中的数据
|
||||
Employee employee = employeeMapper.getByUsername(username);
|
||||
|
||||
//2、处理各种异常情况(用户名不存在、密码不对、账号被锁定)
|
||||
// 2、处理各种异常情况(用户名不存在、密码不对、账号被锁定)
|
||||
if (employee == null) {
|
||||
// 账号不存在
|
||||
throw new AccountNotFoundException(MessageConstant.ACCOUNT_NOT_FOUND);
|
||||
}
|
||||
|
||||
// 密码比对
|
||||
// TODO 后期需要进行md5加密,然后再进行比对
|
||||
password = DigestUtils.md5DigestAsHex(password.getBytes());// Md5加密
|
||||
if (!password.equals(employee.getPassword())) {
|
||||
// 密码错误
|
||||
throw new PasswordErrorException(MessageConstant.PASSWORD_ERROR);
|
||||
|
|
Loading…
Reference in New Issue