mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-08 21:44:32 +02:00
Add an Auto Lock page to enforce logout et prevent CSRF mismatch error
(completes #73 fix)
This commit is contained in:
8
resources/js/api.js
vendored
8
resources/js/api.js
vendored
@ -48,12 +48,8 @@ Vue.axios.interceptors.response.use(response => response, error => {
|
||||
// api calls are stateless so when user inactivity is detected
|
||||
// by the backend middleware it cannot logout the user directly
|
||||
// so it returns a 418 response.
|
||||
// We catch the 418 response and push the user to the login view
|
||||
// with the instruction to request a session logout
|
||||
if ( error.response.status === 418 ) {
|
||||
router.push({ name: 'login', params: { forceLogout: true } })
|
||||
throw new Vue.axios.Cancel();
|
||||
}
|
||||
// We catch the 418 response and push the user to the autolock view
|
||||
if ( error.response.status === 418 ) routeName = 'autolock'
|
||||
|
||||
if ( error.response.status === 404 ) routeName = '404'
|
||||
|
||||
|
Reference in New Issue
Block a user