From 9a8beafc284bcfa2a45f94bb1b5922d817698d4b Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 15 Jan 2024 14:52:20 +0530 Subject: [PATCH] Improved: code for preventing redirect to login on successful log in using browser back button (#51) --- src/views/Login.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index 631448b..0a5cdc9 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -239,7 +239,7 @@ export default defineComponent({ try { await this.authStore.login(username.trim(), password) if (this.authStore.getRedirectUrl) { - window.location.href = `${this.authStore.getRedirectUrl}?oms=${this.authStore.oms}&token=${this.authStore.token.value}&expirationTime=${this.authStore.token.expiration}` + window.location.replace(`${this.authStore.getRedirectUrl}?oms=${this.authStore.oms}&token=${this.authStore.token.value}&expirationTime=${this.authStore.token.expiration}`) } else { // All the failure cases are handled in action, if then block is executing, login is successful this.username = '' @@ -255,7 +255,7 @@ export default defineComponent({ const { token, expirationTime } = this.$route.query as any await this.authStore.samlLogin(token, expirationTime) if (this.authStore.getRedirectUrl) { - window.location.href = `${this.authStore.getRedirectUrl}?oms=${this.authStore.oms}&token=${this.authStore.token.value}&expirationTime=${this.authStore.token.expiration}` + window.location.replace(`${this.authStore.getRedirectUrl}?oms=${this.authStore.oms}&token=${this.authStore.token.value}&expirationTime=${this.authStore.token.expiration}`) } else { this.router.push('/') }