mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
fix password reset redirect bug
This commit is contained in:
Vendored
+1
-1
@@ -50,7 +50,7 @@ const app = new Vue({
|
||||
store,
|
||||
created(){
|
||||
this.routesGuard();
|
||||
if (!this.$store.getters.isAdmin && !('company_marking' in this.$store.getters.getDecodedAccessToken.user) && this.isProtectedRoute()) {
|
||||
if (!this.$store.getters.isAdmin && !('company_marking' in this.$store.getters.getDecodedAccessToken.user) && this.isProtectedRoute() && !this.isWithTokenRoute()) {
|
||||
this.$store.dispatch('crudRequest', {endpoint: this.route('api.account.authentication.refresh'), method: 'get'}).then(response => {
|
||||
let success = response.ok;
|
||||
response.json().then(response => {
|
||||
|
||||
+4
-5
@@ -1,16 +1,15 @@
|
||||
export default {
|
||||
methods: {
|
||||
routesGuard(){
|
||||
(!this.$store.getters.isAuthenticated && this.isProtectedRoute()&& this.isWithTokenRoute()) ? window.location.href = this.route('login') : '';
|
||||
(this.$store.getters.isAuthenticated && !this.isProtectedRoute()&& this.isWithTokenRoute()) ? window.location.href = this.route('dashboard') : '';
|
||||
(!this.$store.getters.isAuthenticated && this.isProtectedRoute()&& !this.isWithTokenRoute()) ? window.location.href = this.route('login') : '';
|
||||
(this.$store.getters.isAuthenticated && !this.isProtectedRoute()&& !this.isWithTokenRoute()) ? window.location.href = this.route('dashboard') : '';
|
||||
},
|
||||
isProtectedRoute(){
|
||||
const unprotectedRoutes = [this.route('login'), this.route('account.email.verification'), this.route('account.password.reset')];
|
||||
const unprotectedRoutes = [this.route('login'), this.route('account.email.verification')];
|
||||
return !unprotectedRoutes.includes(window.location.href);
|
||||
},
|
||||
isWithTokenRoute(){
|
||||
const unprotectedRoutesWithToken = [this.route('account.password.reset')];
|
||||
return !window.location.href.includes(unprotectedRoutesWithToken);
|
||||
return window.location.href.includes(this.route('account.password.reset'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user