refactor: 首次登录重置密码修复
This commit is contained in:
@@ -314,6 +314,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
throw exception(USER_NOT_EXISTS);
|
throw exception(USER_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
userService.updateUserPassword(user.getId(), reqVO.getPassword());
|
userService.firstUpdateUserPassword(user.getId(), reqVO.getPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,14 @@ public interface AdminUserService {
|
|||||||
*/
|
*/
|
||||||
void updateUserPassword(Long id, String password);
|
void updateUserPassword(Long id, String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 首次修改密码
|
||||||
|
*
|
||||||
|
* @param id 用户编号
|
||||||
|
* @param password 密码
|
||||||
|
*/
|
||||||
|
void firstUpdateUserPassword(Long id, String password);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改状态
|
* 修改状态
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
AdminUserDO updateObj = new AdminUserDO();
|
AdminUserDO updateObj = new AdminUserDO();
|
||||||
updateObj.setId(id);
|
updateObj.setId(id);
|
||||||
updateObj.setPassword(encodePassword(password)); // 加密密码
|
updateObj.setPassword(encodePassword(password)); // 加密密码
|
||||||
updateObj.setLoginDate(LocalDateTime.now());
|
|
||||||
userMapper.updateById(updateObj);
|
userMapper.updateById(updateObj);
|
||||||
|
|
||||||
// 3. 记录操作日志上下文
|
// 3. 记录操作日志上下文
|
||||||
@@ -225,6 +224,19 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
LogRecordContext.putVariable("newPassword", updateObj.getPassword());
|
LogRecordContext.putVariable("newPassword", updateObj.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void firstUpdateUserPassword(Long id, String password) {
|
||||||
|
// 1. 校验用户存在
|
||||||
|
AdminUserDO user = validateUserExists(id);
|
||||||
|
|
||||||
|
// 2. 更新密码
|
||||||
|
AdminUserDO updateObj = new AdminUserDO();
|
||||||
|
updateObj.setId(id);
|
||||||
|
updateObj.setPassword(encodePassword(password)); // 加密密码
|
||||||
|
updateObj.setLoginDate(LocalDateTime.now());
|
||||||
|
userMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUserStatus(Long id, Integer status) {
|
public void updateUserStatus(Long id, Integer status) {
|
||||||
// 校验用户存在
|
// 校验用户存在
|
||||||
|
|||||||
Reference in New Issue
Block a user