Sfoglia il codice sorgente

用户模块 登录密码错误异常处理优化

songfuqiang 1 anno fa
parent
commit
618387e126

+ 2 - 1
backend-core/src/main/java/cn/kdan/pdf/backend/core/service/impl/AuthServiceImpl.java

@@ -38,6 +38,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -354,7 +355,7 @@ public class AuthServiceImpl implements AuthService {
                         memberId = member.getId();
                         memberVo.setAvatarUrl(avatarService.selectAvatarByMemberId(memberId));
                     }else {
-                        throw new BackendRuntimeException("账号/密码输入有误");
+                        throw new BadCredentialsException("账号/密码输入有误");
                     }
                 } else {
                     throw new UsernameNotFoundException(AuthConstant.EXCEPTION_MSG_USER_NOT_FOUND);