fix: fix OAuth being stuck if following a public app login

This commit is contained in:
Ruben Fiszel
2024-11-28 16:38:00 +01:00
parent 98eae8a990
commit e1ccffde74
2 changed files with 11 additions and 1 deletions
+10 -1
View File
@@ -15,7 +15,7 @@
import { sendUserToast } from '$lib/toast'
import { isCloudHosted } from '$lib/cloud'
import { refreshSuperadmin } from '$lib/refreshUser'
import { createEventDispatcher } from 'svelte'
import { createEventDispatcher, onMount } from 'svelte'
export let rd: string | undefined = undefined
export let email: string | undefined = undefined
@@ -171,6 +171,14 @@
const dispatch = createEventDispatcher()
onMount(() => {
try {
localStorage.removeItem('closeUponLogin')
} catch (e) {
console.error('Could not remove closeUponLogin from local storage', e)
}
})
function popupListener(event) {
let data = event.data
if (event.origin !== window.location.origin) {
@@ -199,6 +207,7 @@
window.addEventListener('message', popupListener)
window.open(url, '_blank', 'popup')
} else {
localStorage.setItem('closeUponLogin', 'false')
window.location.href = url
}
}
@@ -80,6 +80,7 @@
}
try {
setLicense()
redirectIfNecessary()
checkFirstTimeSetup()