Add an Auto Lock page to enforce logout et prevent CSRF mismatch error

(completes #73 fix)
This commit is contained in:
Bubka
2022-07-13 14:56:25 +02:00
parent aa3c1e9008
commit a2c4348364
5 changed files with 39 additions and 12 deletions

8
resources/js/api.js vendored
View File

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