From 8fc4348b933d22d6a794219ce672be0f34c7099e Mon Sep 17 00:00:00 2001 From: zwzw1219 Date: Sat, 14 Oct 2017 10:06:50 +0800 Subject: [PATCH] 1 --- .../boot/security/server/config/SecurityConfig.java | 11 ++++++----- src/main/resources/public/login.html | 9 +++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/boot/security/server/config/SecurityConfig.java b/src/main/java/com/boot/security/server/config/SecurityConfig.java index 36d8b79..7d3a0c4 100644 --- a/src/main/java/com/boot/security/server/config/SecurityConfig.java +++ b/src/main/java/com/boot/security/server/config/SecurityConfig.java @@ -27,11 +27,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() - .antMatchers("/statics/**", "/v2/api-docs/**", "/swagger-resources/**", "/swagger-ui.html", - "/webjars/**") - .permitAll().anyRequest().authenticated().and().formLogin().loginProcessingUrl("/login") - .successHandler(authenticationSuccessHandler).failureHandler(authenticationFailureHandler).and() - .logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler).and().csrf().disable(); + .antMatchers("/login.html", "/statics/**", "/v2/api-docs/**", "/swagger-resources/**", + "/swagger-ui.html", "/webjars/**") + .permitAll().anyRequest().authenticated().and().formLogin().loginPage("/login.html") + .loginProcessingUrl("/login").successHandler(authenticationSuccessHandler) + .failureHandler(authenticationFailureHandler).and().logout().logoutUrl("/logout") + .logoutSuccessHandler(logoutSuccessHandler).and().csrf().disable(); } @Override diff --git a/src/main/resources/public/login.html b/src/main/resources/public/login.html index 408a026..ade87e5 100644 --- a/src/main/resources/public/login.html +++ b/src/main/resources/public/login.html @@ -38,10 +38,10 @@ parent.location.href = '/login.html'; } - var user = loginInfo(); + /* var user = loginInfo(); if (user != "") { location.href = '/'; - } + } */ function login(obj) { $(obj).attr("disabled", true); @@ -54,9 +54,10 @@ } else { $.ajax({ type : 'post', - url : '/sys/login', + url : '/login', data : $("#login-form").serialize(), - success : function() { + success : function(data) { + console.log(data) location.href = '/'; }, error : function(xhr, textStatus, errorThrown) {