mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-23 21:41:44 +02:00
Rearrange BeforeEach hook - New fix for #232
This commit is contained in:
parent
0ddb2e7551
commit
1f000aab9b
14
resources/js/routes.js
vendored
14
resources/js/routes.js
vendored
@ -82,9 +82,15 @@ router.beforeEach((to, from, next) => {
|
||||
// See https://github.com/garethredfern/laravel-vue/ if one day the middleware pattern
|
||||
// becomes relevant (i.e when some admin only pages are necessary)
|
||||
|
||||
if (to.name !== 'login' && to.meta.requiresAuth && ! Vue.$storage.get('authenticated', false)) {
|
||||
if (to.meta.requiresAuth
|
||||
&& ! Vue.$storage.get('authenticated', false)
|
||||
&& ! window.appConfig.proxyAuth) {
|
||||
next({ name: 'login' })
|
||||
}
|
||||
else if (to.matched.some(record => record.meta.disabledWithAuthProxy) && window.appConfig.proxyAuth) {
|
||||
// The page is not relevant with auth proxy On so we push to the main view
|
||||
next({ name: 'accounts' })
|
||||
}
|
||||
else if (to.name.startsWith('settings.')) {
|
||||
if (to.params.returnTo == undefined) {
|
||||
if (from.params.returnTo) {
|
||||
@ -107,12 +113,6 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
else next({ name: to.name, params: {goBackTo: '/accounts'} })
|
||||
}
|
||||
else if (to.matched.some(record => record.meta.disabledWithAuthProxy)) {
|
||||
if (window.appConfig.proxyAuth) {
|
||||
next({ name: 'accounts' })
|
||||
}
|
||||
else next()
|
||||
}
|
||||
else if (to.name === 'genericError' && to.params.err == undefined) {
|
||||
// return to home if no err object is provided to prevent an empty error message
|
||||
next({ name: 'accounts' });
|
||||
|
Loading…
x
Reference in New Issue
Block a user