From ea6b0efbfd58ab4a2f0a7c9f504688e7f4e12102 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期一, 30 八月 2021 16:29:06 +0800 Subject: [PATCH] Merge branch 'test' into zzj --- springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginFailureHandler.java | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginFailureHandler.java b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginFailureHandler.java index 7bc3abe..9d4d685 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginFailureHandler.java +++ b/springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/handel/UserLoginFailureHandler.java @@ -1,8 +1,8 @@ package com.panzhihua.auth.handel; -import com.panzhihua.common.utlis.ResultUtil; -import com.panzhihua.common.model.vos.R; -import lombok.extern.slf4j.Slf4j; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.LockedException; import org.springframework.security.core.AuthenticationException; @@ -10,8 +10,10 @@ import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.utlis.ResultUtil; + +import lombok.extern.slf4j.Slf4j; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -24,21 +26,23 @@ public class UserLoginFailureHandler implements AuthenticationFailureHandler { /** * 登录失败返回结果 + * * @Author youcong */ @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception){ + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, + AuthenticationException exception) { log.info("登录失败"); // 这些对于操作的处理类可以根据不同异常进行不同处理 - if (exception instanceof UsernameNotFoundException){ + if (exception instanceof UsernameNotFoundException) { ResultUtil.responseJson(response, R.fail("该账号不存在")); } - if (exception instanceof LockedException){ - ResultUtil.responseJson(response,R.fail("用户被冻结")); + if (exception instanceof LockedException) { + ResultUtil.responseJson(response, R.fail("用户被冻结")); } - if (exception instanceof BadCredentialsException){ - ResultUtil.responseJson(response,R.fail("密码错误")); + if (exception instanceof BadCredentialsException) { + ResultUtil.responseJson(response, R.fail("密码错误")); } - ResultUtil.responseJson(response,R.fail("登录失败")); + ResultUtil.responseJson(response, R.fail("登录失败")); } } -- Gitblit v1.7.1