登出功能

This commit is contained in:
XinWei 2024-07-17 14:01:44 +08:00
parent b14f06b8fa
commit 82e4b54677
4 changed files with 13 additions and 9 deletions

View File

@ -35,10 +35,10 @@ public class SecurityConfiguration {
httpSecurity.csrf().disable() // 禁用 CSRF 保护 httpSecurity.csrf().disable() // 禁用 CSRF 保护
.authorizeRequests() .authorizeRequests()
// 1. 静态资源可匿名访问 // 1. 静态资源可匿名访问
.antMatchers("/**").permitAll()
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
// 2. 登录相关的接口可匿名访问 // 2. 登录相关的接口可匿名访问
.antMatchers("/toLogin").permitAll() .antMatchers("/toLogin").permitAll()
.antMatchers("/**").permitAll()
.antMatchers("/auth/login-by-code").permitAll() .antMatchers("/auth/login-by-code").permitAll()
.antMatchers("/auth/refresh-token").permitAll() .antMatchers("/auth/refresh-token").permitAll()
.antMatchers("/auth/logout").permitAll() .antMatchers("/auth/logout").permitAll()

View File

@ -39,10 +39,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
t t.id,
.
id
,
t.job_group, t.job_group,
t.job_desc, t.job_desc,
t.add_time, t.add_time,

View File

@ -8,8 +8,15 @@ $(function(){
btn: [ I18n.system_ok, I18n.system_cancel ] btn: [ I18n.system_ok, I18n.system_cancel ]
}, function(index){ }, function(index){
layer.close(index); layer.close(index);
// 直接清理cookie直接设置过期
$.post(base_url + "/logout", function(data, status) { document.cookie = "ACCESS_TOKEN=; max-age=0; path=/xxl-job-admin";
document.cookie = "REFRESH_TOKEN=; max-age=0; path=/xxl-job-admin";
layer.open({
icon: '2',
title: I18n.system_tips,
content: ('已退出登录请关闭当前会话框!' || I18n.logout_success)
});
/*$.post(base_url + "/logout", function(data, status) {
if (data.code == "200") { if (data.code == "200") {
layer.msg( I18n.logout_success ); layer.msg( I18n.logout_success );
setTimeout(function(){ setTimeout(function(){
@ -23,7 +30,7 @@ $(function(){
icon: '2' icon: '2'
}); });
} }
}); });*/
}); });
}); });

View File

@ -88,7 +88,7 @@
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li id="updatePwd" ><a href="javascript:">${I18n.change_pwd}</a></li> <#-- <li id="updatePwd" ><a href="javascript:">${I18n.change_pwd}</a></li>-->
<li id="logoutBtn" ><a href="javascript:">${I18n.logout_btn}</a></li> <li id="logoutBtn" ><a href="javascript:">${I18n.logout_btn}</a></li>
</ul> </ul>
</li> </li>