feat: show close-tab message after OAuth redirect
Show a "You can close this tab now" message after the OAuth authorize page redirects to the desktop app, instead of leaving a stale "Authenticating..." message in the browser tab.
This commit is contained in:
parent
a12002de6d
commit
495f34f60e
|
|
@ -162,7 +162,8 @@
|
|||
"tokenCreated": "Here is your new token: {token}",
|
||||
"wontSeeItAgain": "Write it down or save it securely — you will not be able to see it again.",
|
||||
"mustUseToken": "You need to create a CalDAV token to use CalDAV with any third-party client. Enter the token in the password field of your client.",
|
||||
"usernameIs": "Your username for CalDAV is: {0}"
|
||||
"usernameIs": "Your username for CalDAV is: {0}",
|
||||
"apiTokenHint": "You can also use an API token with CalDAV permission. Create one in {link}."
|
||||
},
|
||||
"avatar": {
|
||||
"title": "Avatar",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
>
|
||||
{{ errorMessage }}
|
||||
</Message>
|
||||
<Message v-if="loading">
|
||||
<Message v-if="redirectedToApp">
|
||||
{{ $t('user.auth.oauthRedirectedToApp') }}
|
||||
</Message>
|
||||
<Message v-else-if="loading">
|
||||
{{ $t('user.auth.authenticating') }}
|
||||
</Message>
|
||||
</div>
|
||||
|
|
@ -28,6 +31,7 @@ const route = useRoute()
|
|||
|
||||
const loading = ref(true)
|
||||
const errorMessage = ref('')
|
||||
const redirectedToApp = ref(false)
|
||||
|
||||
const requiredParams = [
|
||||
'response_type',
|
||||
|
|
@ -65,10 +69,12 @@ async function authorize() {
|
|||
redirectUrl.searchParams.set('state', state)
|
||||
}
|
||||
|
||||
redirectedToApp.value = true
|
||||
loading.value = false
|
||||
|
||||
window.location.href = redirectUrl.toString()
|
||||
} catch (e) {
|
||||
errorMessage.value = getErrorText(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue