Skip to content

Commit 6838fbe

Browse files
committed
Show confirmation message after resending email
1 parent 52ce2db commit 6838fbe

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

apps/web/src/routes/(app)/login/+page.svelte

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
1515
let error = $state<string>();
1616
let errorCode = $state<string>();
17+
let confirmationSent = $state<boolean>(false);
1718
1819
const isFormValid = $derived(!!email && !!password);
1920
@@ -50,9 +51,16 @@
5051
if (response.type === 'error') {
5152
error = response.errorMessage;
5253
errorCode = response.errorCode;
54+
confirmationSent = false;
5355
console.error('Failed to resend confirmation email:', response.raw ?? response.errorMessage);
5456
} else {
55-
error = 'Confirmation email resent. Please check your inbox.';
57+
error = undefined;
58+
errorCode = undefined;
59+
confirmationSent = true;
60+
// Clear the confirmation message after 5 seconds
61+
setTimeout(() => {
62+
confirmationSent = false;
63+
}, 5000);
5664
}
5765
}
5866
</script>
@@ -89,7 +97,13 @@
8997

9098
<Button type="submit" style="pop" disabled={!isFormValid}>Log in</Button>
9199

92-
{#if error}
100+
{#if confirmationSent}
101+
<InfoMessage filled outlined={false} style="success" class="m-top-16">
102+
{#snippet content()}
103+
<p>Confirmation email sent! Please check your inbox.</p>
104+
{/snippet}
105+
</InfoMessage>
106+
{:else if error}
93107
<InfoMessage filled outlined={false} style="error" class="m-top-16">
94108
{#snippet content()}
95109
{#if errorCode === 'email_not_verified'}

0 commit comments

Comments
 (0)