diff --git a/vhr/vhr.iml b/vhr/vhr.iml deleted file mode 100644 index f409c0ea8..000000000 --- a/vhr/vhr.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/vhr/vhrserver/vhr-mapper/vhr-mapper.iml b/vhr/vhrserver/vhr-mapper/vhr-mapper.iml deleted file mode 100644 index 3cd9385f8..000000000 --- a/vhr/vhrserver/vhr-mapper/vhr-mapper.iml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vhr/vhrserver/vhr-model/vhr-model.iml b/vhr/vhrserver/vhr-model/vhr-model.iml deleted file mode 100644 index 87389d951..000000000 --- a/vhr/vhrserver/vhr-model/vhr-model.iml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vhr/vhrserver/vhr-service/vhr-service.iml b/vhr/vhrserver/vhr-service/vhr-service.iml deleted file mode 100644 index 3596486c8..000000000 --- a/vhr/vhrserver/vhr-service/vhr-service.iml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/LoginFilter.java b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/LoginFilter.java index 98e53cb5b..1125aa42a 100644 --- a/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/LoginFilter.java +++ b/vhr/vhrserver/vhr-web/src/main/java/org/javaboy/vhr/config/LoginFilter.java @@ -28,11 +28,11 @@ public class LoginFilter extends UsernamePasswordAuthenticationFilter { @Autowired SessionRegistry sessionRegistry; + @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { if (!request.getMethod().equals("POST")) { - throw new AuthenticationServiceException( - "Authentication method not supported: " + request.getMethod()); + throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } String verify_code = (String) request.getSession().getAttribute("verify_code"); if (request.getContentType().contains(MediaType.APPLICATION_JSON_VALUE) || request.getContentType().contains(MediaType.APPLICATION_JSON_UTF8_VALUE)) { @@ -40,9 +40,9 @@ public Authentication attemptAuthentication(HttpServletRequest request, HttpServ try { loginData = new ObjectMapper().readValue(request.getInputStream(), Map.class); } catch (IOException e) { - }finally { + } finally { String code = loginData.get("code"); - checkCode(response, code, verify_code); + checkCode(request, response, code, verify_code); } String username = loginData.get(getUsernameParameter()); String password = loginData.get(getPasswordParameter()); @@ -53,23 +53,24 @@ public Authentication attemptAuthentication(HttpServletRequest request, HttpServ password = ""; } username = username.trim(); - UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( - username, password); + UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); setDetails(request, authRequest); Hr principal = new Hr(); principal.setUsername(username); sessionRegistry.registerNewSession(request.getSession(true).getId(), principal); return this.getAuthenticationManager().authenticate(authRequest); } else { - checkCode(response, request.getParameter("code"), verify_code); + checkCode(request, response, request.getParameter("code"), verify_code); return super.attemptAuthentication(request, response); } } - public void checkCode(HttpServletResponse resp, String code, String verify_code) { + public void checkCode(HttpServletRequest request, HttpServletResponse resp, String code, String verify_code) { if (code == null || verify_code == null || "".equals(code) || !verify_code.toLowerCase().equals(code.toLowerCase())) { - //验证码不正确 + // 验证码不正确 throw new AuthenticationServiceException("验证码不正确"); } + // 验证通过后使验证码失效 + request.getSession().removeAttribute("verify_code"); } } diff --git a/vhr/vhrserver/vhr-web/vhr-web.iml b/vhr/vhrserver/vhr-web/vhr-web.iml deleted file mode 100644 index 24f94a247..000000000 --- a/vhr/vhrserver/vhr-web/vhr-web.iml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vhr/vhrserver/vhrserver.iml b/vhr/vhrserver/vhrserver.iml deleted file mode 100644 index f409c0ea8..000000000 --- a/vhr/vhrserver/vhrserver.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file