mirror of
https://github.com/gotson/komga.git
synced 2026-04-16 12:01:09 +02:00
fix: logout was broken after remember-me was added
This commit is contained in:
parent
0f50a7690f
commit
8b02471be1
3 changed files with 19 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ const vuexModule: Module<any, any> = {
|
||||||
},
|
},
|
||||||
async logout ({ commit }) {
|
async logout ({ commit }) {
|
||||||
try {
|
try {
|
||||||
await service.getMeWithAuth('', '')
|
await service.logout()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
commit('setMe', {})
|
commit('setMe', {})
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { AxiosInstance } from 'axios'
|
||||||
const API_USERS = '/api/v1/users'
|
const API_USERS = '/api/v1/users'
|
||||||
|
|
||||||
export default class KomgaUsersService {
|
export default class KomgaUsersService {
|
||||||
private http: AxiosInstance;
|
private http: AxiosInstance
|
||||||
|
|
||||||
constructor (http: AxiosInstance) {
|
constructor (http: AxiosInstance) {
|
||||||
this.http = http
|
this.http = http
|
||||||
|
|
@ -105,4 +105,16 @@ export default class KomgaUsersService {
|
||||||
throw new Error(msg)
|
throw new Error(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async logout () {
|
||||||
|
try {
|
||||||
|
await this.http.post(`${API_USERS}/logout`)
|
||||||
|
} catch (e) {
|
||||||
|
let msg = `An error occurred while trying to logout`
|
||||||
|
if (e.response.data.message) {
|
||||||
|
msg += `: ${e.response.data.message}`
|
||||||
|
}
|
||||||
|
throw new Error(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ class SecurityConfiguration(
|
||||||
.and()
|
.and()
|
||||||
.httpBasic()
|
.httpBasic()
|
||||||
|
|
||||||
|
.and()
|
||||||
|
.logout()
|
||||||
|
.logoutUrl("/api/v1/users/logout")
|
||||||
|
.deleteCookies("JSESSIONID")
|
||||||
|
|
||||||
.and()
|
.and()
|
||||||
.sessionManagement()
|
.sessionManagement()
|
||||||
.maximumSessions(10)
|
.maximumSessions(10)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue