Browse Source

fix: [系统管理] [用户管理] 修改验证码密码得方法

master
memorylkf 1 week ago
parent
commit
9772667bf6
2 changed files with 17 additions and 7 deletions
  1. +5
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java
  2. +12
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java

+ 5
- 2
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/ISysUserService.java View File

@ -238,15 +238,18 @@ public interface ISysUserService
* 检查密码是否正确 * 检查密码是否正确
* @param userId * @param userId
* @param password * @param password
* @param needName
* @return * @return
*/ */
Boolean checkPassword(Long userId,String password);
Boolean checkPassword(Long userId,String password,Boolean needName);
/** /**
* 检查密码是否正确 * 检查密码是否正确
* @param user * @param user
* @param password * @param password
* @param needName
* @return * @return
*/ */
Boolean checkPassword(SysUser user,String password);
Boolean checkPassword(SysUser user,String password,Boolean needName);
} }

+ 12
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/system/service/impl/SysUserServiceImpl.java View File

@ -581,13 +581,20 @@ public class SysUserServiceImpl implements ISysUserService
} }
@Override @Override
public Boolean checkPassword(Long userId, String password) {
SysUser user = selectUserById(userId);
return checkPassword(user,password);
public Boolean checkPassword(Long userId, String password, Boolean needName) {
SysUser sysUser = selectUserById(userId);
if(sysUser==null){
throw new ServiceException("用户不存在");
}
return checkPassword(sysUser,password,needName);
} }
@Override @Override
public Boolean checkPassword(SysUser user, String password) {
return SecurityUtils.matchesPassword(password,user.getPassword());
public Boolean checkPassword(SysUser user, String password, Boolean needName) {
if(SecurityUtils.matchesPassword(password,user.getPassword())){
return true;
}
throw new ServiceException((needName?user.getNickName():"")+"密码错误");
} }
} }

Loading…
Cancel
Save