提交 3157a48e 编写于 作者: terrfly's avatar terrfly

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

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