aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/forgot
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-07 22:34:23 -0800
committerAdam Soltys <[email protected]>2023-12-07 22:34:23 -0800
commit8940118dd22c5f2ab680ef8036bcfafecc5696ab (patch)
treea49db92b3ba5f8668cc79ab1dae46e7a09999ba0 /src/routes/(app)/forgot
parent00e88944abb529d07e189f1181de8a4804f8ae9c (diff)
downloadcoinos-ui-8940118dd22c5f2ab680ef8036bcfafecc5696ab.tar.gz
coinos-ui-8940118dd22c5f2ab680ef8036bcfafecc5696ab.zip
password reset
Diffstat (limited to 'src/routes/(app)/forgot')
-rw-r--r--src/routes/(app)/forgot/+page.server.js4
-rw-r--r--src/routes/(app)/forgot/+page.svelte62
2 files changed, 40 insertions, 26 deletions
diff --git a/src/routes/(app)/forgot/+page.server.js b/src/routes/(app)/forgot/+page.server.js
index db2005e7..48411539 100644
--- a/src/routes/(app)/forgot/+page.server.js
+++ b/src/routes/(app)/forgot/+page.server.js
@@ -3,13 +3,11 @@ import { fd, post, login } from "$lib/utils";
export const actions = {
default: async ({ request }) => {
- let { email } = await fd(request);
-
try {
+ let { email } = await fd(request);
await post("/forgot", { email });
return { success: true };
} catch (e) {
- console.log(e.message);
return fail(400, { error: e.message });
}
},
diff --git a/src/routes/(app)/forgot/+page.svelte b/src/routes/(app)/forgot/+page.svelte
index 91c4290a..9490d531 100644
--- a/src/routes/(app)/forgot/+page.svelte
+++ b/src/routes/(app)/forgot/+page.svelte
@@ -1,4 +1,6 @@
<script>
+ import { focus } from "$lib/utils";
+ import { enhance } from "$app/forms";
import { t } from "$lib/translations";
import Icon from "$comp/Icon.svelte";
import Spinner from "$comp/Spinner.svelte";
@@ -28,31 +30,45 @@
</div>
{/if}
- <form class="space-y-5" method="POST">
- <div>
- <label for="email" class="font-semibold">{$t("login.email")}</label>
- <input
- name="email"
- type="text"
- required
- class="bg-primary"
- bind:value={email}
- use:focus
- autocapitalize="none"
- />
+ {#if form?.success}
+ <div class="text-secondary">
+ A password reset link will be sent to your email if we have it on file.
</div>
- <button
- type="submit"
- class="bg-black text-white w-full rounded-2xl p-4 font-semibold hover:opacity-80"
- disabled={loading}>
- {#if loading}
- <Spinner />
- {:else}
- {$t("login.submit")}
- {/if}
- </button>
- </form>
+ <div class="flex w-full">
+ <a
+ href="/login"
+ class="bg-black text-white w-full rounded-2xl p-4 font-semibold hover:opacity-80 text-center">
+ Continue
+ </a>
+ </div>
+ {:else}
+ <form class="space-y-5" method="POST" use:enhance>
+ <div>
+ <label for="email" class="font-semibold">{$t("login.email")}</label>
+ <input
+ name="email"
+ type="text"
+ required
+ class="bg-primary"
+ bind:value={email}
+ use:focus
+ autocapitalize="none"
+ />
+ </div>
+
+ <button
+ type="submit"
+ class="bg-black text-white w-full rounded-2xl p-4 font-semibold hover:opacity-80"
+ disabled={loading}>
+ {#if loading}
+ <Spinner />
+ {:else}
+ {$t("login.submit")}
+ {/if}
+ </button>
+ </form>
+ {/if}
</div>
</div>
</div>