zwzw1219 2017-10-14 10:06:50 +08:00
parent 35cf0df44e
commit 8fc4348b93
2 changed files with 11 additions and 9 deletions

View File

@ -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

View File

@ -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) {