密码修改

This commit is contained in:
haozq 2024-11-15 18:35:06 +08:00
parent 5bc667038d
commit 34a97db42e
1 changed files with 3 additions and 7 deletions

View File

@ -43,15 +43,11 @@ public class UserAuthenticationProvider implements AuthenticationProvider {
if (userInfo == null) { if (userInfo == null) {
throw new UsernameNotFoundException("用户名不存在"); throw new UsernameNotFoundException("用户名不存在");
} }
try {
//密码加密 //密码加密
String daya= Md5Utils.createPwdEncrypt(userName,Md5Utils.generateMD5(password).toUpperCase(),userInfo.getSalt()); String daya= Md5Utils.createPwdEncrypt(userName,password.toUpperCase(),userInfo.getSalt());
if(!Md5Utils.validatePasswordBast64(daya, userInfo.getPassword())){ if(!Md5Utils.validatePasswordBast64(daya, userInfo.getPassword())){
throw new BadCredentialsException("密码不正确"); throw new BadCredentialsException("密码不正确");
} }
} catch (NoSuchAlgorithmException e) {
throw new BadCredentialsException("密码不正确");
}
// 我们还要判断密码是否正确这里我们的密码使用BCryptPasswordEncoder进行加密的 // 我们还要判断密码是否正确这里我们的密码使用BCryptPasswordEncoder进行加密的