Skip to content

Commit

Permalink
Improved: code for preventing redirect to login on successful log in …
Browse files Browse the repository at this point in the history
…using browser back button (#51)
  • Loading branch information
amansinghbais committed Jan 15, 2024
1 parent 745259a commit 9a8beaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -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('/')
}
Expand Down

0 comments on commit 9a8beaf

Please sign in to comment.