mirror of
https://github.com/gotson/komga.git
synced 2025-12-20 23:45:11 +01: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 }) {
|
||||
try {
|
||||
await service.getMeWithAuth('', '')
|
||||
await service.logout()
|
||||
} catch (e) {
|
||||
}
|
||||
commit('setMe', {})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { AxiosInstance } from 'axios'
|
|||
const API_USERS = '/api/v1/users'
|
||||
|
||||
export default class KomgaUsersService {
|
||||
private http: AxiosInstance;
|
||||
private http: AxiosInstance
|
||||
|
||||
constructor (http: AxiosInstance) {
|
||||
this.http = http
|
||||
|
|
@ -105,4 +105,16 @@ export default class KomgaUsersService {
|
|||
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()
|
||||
.httpBasic()
|
||||
|
||||
.and()
|
||||
.logout()
|
||||
.logoutUrl("/api/v1/users/logout")
|
||||
.deleteCookies("JSESSIONID")
|
||||
|
||||
.and()
|
||||
.sessionManagement()
|
||||
.maximumSessions(10)
|
||||
|
|
|
|||
Loading…
Reference in a new issue