refactor: 首次登录重置密码修复
This commit is contained in:
1 parent
1cfc935130
commit
100ca67eec
3 files changed
+22
-2
No files matched your search
+1
-1
@@ -314,6 +314,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
userService.updateUserPassword(user.getId(), reqVO.getPassword());
|
||||
userService.firstUpdateUserPassword(user.getId(), reqVO.getPassword());
|
||||
}
|
||||
}
|
||||
+8
@@ -80,6 +80,14 @@ public interface AdminUserService {
|
||||
*/
|
||||
void updateUserPassword(Long id, String password);
|
||||
|
||||
/**
|
||||
* 首次修改密码
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @param password 密码
|
||||
*/
|
||||
void firstUpdateUserPassword(Long id, String password);
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*
|
||||
|
||||
+13
-1
@@ -217,7 +217,6 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
AdminUserDO updateObj = new AdminUserDO();
|
||||
updateObj.setId(id);
|
||||
updateObj.setPassword(encodePassword(password)); // 加密密码
|
||||
updateObj.setLoginDate(LocalDateTime.now());
|
||||
userMapper.updateById(updateObj);
|
||||
|
||||
// 3. 记录操作日志上下文
|
||||
@@ -225,6 +224,19 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
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
|
||||
public void updateUserStatus(Long id, Integer status) {
|
||||
// 校验用户存在
|
||||
|
||||
Reference in new issue
Block a user