diff --git a/resources/js/components/SettingTabs.vue b/resources/js/components/SettingTabs.vue
index 199c5e97..59148f21 100644
--- a/resources/js/components/SettingTabs.vue
+++ b/resources/js/components/SettingTabs.vue
@@ -4,7 +4,7 @@
-
- {{ tab.name }}
+ {{ tab.name }}
diff --git a/resources/js/routes.js b/resources/js/routes.js
index bba3e90b..1fbee762 100644
--- a/resources/js/routes.js
+++ b/resources/js/routes.js
@@ -85,6 +85,22 @@ router.beforeEach((to, from, next) => {
if (to.name !== 'login' && to.meta.requiresAuth && ! Vue.$storage.get('authenticated', false)) {
next({ name: 'login' })
}
+ else if (to.name.startsWith('settings.')) {
+ if (to.params.returnTo == undefined) {
+ if (from.params.returnTo) {
+ next({name: to.name, params: { returnTo: from.params.returnTo }})
+ }
+ else if (from.name) {
+ next({name: to.name, params: { returnTo: from.path }})
+ }
+ else {
+ next({name: to.name, params: { returnTo: '/accounts' }})
+ }
+ }
+ else {
+ next()
+ }
+ }
else if (to.matched.some(record => record.meta.disabledWithAuthProxy)) {
if (window.appConfig.proxyAuth) {
next({ name: 'accounts' })
diff --git a/resources/js/views/settings/Account.vue b/resources/js/views/settings/Account.vue
index 7bd10033..487785af 100644
--- a/resources/js/views/settings/Account.vue
+++ b/resources/js/views/settings/Account.vue
@@ -151,19 +151,6 @@
},
},
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (from.params.returnTo) {
- to.params.returnTo = from.params.returnTo
- }
- else {
- to.params.returnTo = from.name
- ? from.path
- : '/accounts'
- }
- })
- },
-
beforeRouteLeave(to, from, next) {
if (to.name == 'accounts') {
this.$notify({ clean: true })
diff --git a/resources/js/views/settings/OAuth.vue b/resources/js/views/settings/OAuth.vue
index 9431a27d..57d77d02 100644
--- a/resources/js/views/settings/OAuth.vue
+++ b/resources/js/views/settings/OAuth.vue
@@ -156,19 +156,6 @@
},
},
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (from.params.returnTo) {
- to.params.returnTo = from.params.returnTo
- }
- else {
- to.params.returnTo = from.name
- ? from.path
- : '/accounts'
- }
- })
- },
-
beforeRouteLeave(to, from, next) {
if (to.name == 'accounts') {
this.$notify({ clean: true })
diff --git a/resources/js/views/settings/Options.vue b/resources/js/views/settings/Options.vue
index fb7c4b41..549c74f4 100644
--- a/resources/js/views/settings/Options.vue
+++ b/resources/js/views/settings/Options.vue
@@ -260,19 +260,6 @@
},
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (from.params.returnTo) {
- to.params.returnTo = from.params.returnTo
- }
- else {
- to.params.returnTo = from.name
- ? from.path
- : '/accounts'
- }
- })
- },
-
beforeRouteLeave(to, from, next) {
if (to.name == 'accounts') {
this.$notify({ clean: true })
diff --git a/resources/js/views/settings/WebAuthn.vue b/resources/js/views/settings/WebAuthn.vue
index af94cbe9..5e95cf6c 100644
--- a/resources/js/views/settings/WebAuthn.vue
+++ b/resources/js/views/settings/WebAuthn.vue
@@ -224,19 +224,6 @@
},
- beforeRouteEnter(to, from, next) {
- next(vm => {
- if (from.params.returnTo) {
- to.params.returnTo = from.params.returnTo
- }
- else {
- to.params.returnTo = from.name
- ? from.path
- : '/accounts'
- }
- })
- },
-
beforeRouteLeave(to, from, next) {
if (to.name == 'accounts') {
this.$notify({ clean: true })