Commit 3157a48e authored by terrfly's avatar terrfly
Browse files

解决密码输入有误提示错误的问题;

parent a0fcb7f7
......@@ -33,6 +33,7 @@ import com.jeequan.jeepay.service.mapper.SysEntitlementMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
......@@ -81,10 +82,13 @@ public class AuthService {
authentication = authenticationManager.authenticate(upToken);
} catch (JeepayAuthenticationException jex) {
throw jex.getBizException() == null ? new BizException(jex.getMessage()) : jex.getBizException();
} catch (BadCredentialsException e) {
throw new BizException("用户名/密码错误!");
} catch (AuthenticationException e) {
log.error("AuthenticationException:", e);
throw new BizException("认证服务出现异常, 请重试或联系系统管理员!");
}
JeeUserDetails jeeUserDetails = (JeeUserDetails) authentication.getPrincipal();
//验证通过后 再查询用户角色和权限信息集合
......
......@@ -35,6 +35,7 @@ import com.jeequan.jeepay.service.mapper.SysEntitlementMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
......@@ -83,6 +84,8 @@ public class AuthService {
authentication = authenticationManager.authenticate(upToken);
} catch (JeepayAuthenticationException jex) {
throw jex.getBizException() == null ? new BizException(jex.getMessage()) : jex.getBizException();
} catch (BadCredentialsException e) {
throw new BizException("用户名/密码错误!");
} catch (AuthenticationException e) {
log.error("AuthenticationException:", e);
throw new BizException("认证服务出现异常, 请重试或联系系统管理员!");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment