Skip to content

Commit d03a7fc

Browse files
committed
Update the OAuth2 success and failure pages
1. Update design to be more consistent with other pages, while still unbranded 2. Update sizing to be more mobile friendly as the original heading size was truncated on mobile 3. Show a different message when redirecting back to the app to clarify the login was successful 4. Close the window after redirecting so the user doesn't have to
1 parent 30f0a3d commit d03a7fc

2 files changed

Lines changed: 54 additions & 18 deletions

File tree

src/routes/auth/oauth2/failure/+page.svelte

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,36 @@
44
import { Heading } from '$lib/components';
55
import { onMount } from 'svelte';
66
7-
onMount(async () => {
7+
let redirecting = false;
8+
9+
onMount(() => {
810
const project = $page.url.searchParams.get('project');
911
if (project) {
10-
await goto(`appwrite-callback-${project}://${$page.url.search}`);
12+
redirecting = true;
13+
setTimeout(async () => {
14+
await goto(`appwrite-callback-${project}://${$page.url.search}`);
15+
window.close();
16+
}, 3000);
1117
}
1218
});
19+
20+
$: heading = redirecting ? 'Login failed' : 'Missing Redirect URL';
1321
</script>
1422

15-
<Heading tag="h1" size="1">Missing Redirect URL</Heading>
16-
<p class="text">
17-
Your OAuth login flow is missing a proper redirect URL. Please check the
18-
<a class="link" href="https://appwrite.io/docs/client/account?sdk=web#createOAuth2Session"
19-
>OAuth docs</a>
20-
and send request for new session with a valid callback URL.
21-
</p>
23+
<article class="card u-padding-16">
24+
<div class="u-flex u-flex-vertical u-gap-16">
25+
<Heading tag="h1" size="4">{heading}</Heading>
26+
<p class="text">
27+
{#if redirecting}
28+
You will be automatically redirected back to your app shortly.
29+
{:else}
30+
Your OAuth login flow is missing a proper redirect URL. Please check the
31+
<a
32+
class="link"
33+
href="https://appwrite.io/docs/client/account?sdk=web#createOAuth2Session"
34+
>OAuth docs</a>
35+
and send request for new session with a valid callback URL.
36+
{/if}
37+
</p>
38+
</div>
39+
</article>

src/routes/auth/oauth2/success/+page.svelte

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,36 @@
44
import { Heading } from '$lib/components';
55
import { onMount } from 'svelte';
66
7-
onMount(async () => {
7+
let redirecting = false;
8+
9+
onMount(() => {
810
const project = $page.url.searchParams.get('project');
911
if (project) {
10-
await goto(`appwrite-callback-${project}://${$page.url.search}`);
12+
redirecting = true;
13+
setTimeout(async () => {
14+
await goto(`appwrite-callback-${project}://${$page.url.search}`);
15+
window.close();
16+
}, 3000);
1117
}
1218
});
19+
20+
$: heading = redirecting ? "You're now logged in" : 'Missing Redirect URL';
1321
</script>
1422

15-
<Heading tag="h1" size="1">Missing Redirect URL</Heading>
16-
<p class="text">
17-
Your OAuth login flow is missing a proper redirect URL. Please check the
18-
<a class="link" href="https://appwrite.io/docs/client/account?sdk=web#createOAuth2Session"
19-
>OAuth docs</a>
20-
and send request for new session with a valid callback URL.
21-
</p>
23+
<article class="card u-padding-16">
24+
<div class="u-flex u-flex-vertical u-gap-16">
25+
<Heading tag="h1" size="4">{heading}</Heading>
26+
<p class="text">
27+
{#if redirecting}
28+
You will be automatically redirected back to your app shortly.
29+
{:else}
30+
Your OAuth login flow is missing a proper redirect URL. Please check the
31+
<a
32+
class="link"
33+
href="https://appwrite.io/docs/client/account?sdk=web#createOAuth2Session"
34+
>OAuth docs</a>
35+
and send request for new session with a valid callback URL.
36+
{/if}
37+
</p>
38+
</div>
39+
</article>

0 commit comments

Comments
 (0)