From 72cc46009e891f3104602fd3b73e6ac23576f55d Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Thu, 29 Sep 2022 22:47:30 +0800 Subject: feat: !WIP Implement password reset request fulfillment --- apps/kit/src/lib/i18n/en/index.ts | 3 +- apps/kit/src/lib/i18n/i18n-types.ts | 8 ++ .../(public)/reset-password/[id]/+page.server.ts | 11 ++ .../(public)/reset-password/[id]/+page.svelte | 121 +++++++++++++++++++++ 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.server.ts create mode 100644 apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.svelte (limited to 'apps') diff --git a/apps/kit/src/lib/i18n/en/index.ts b/apps/kit/src/lib/i18n/en/index.ts index 5a3ccc8..003de0d 100644 --- a/apps/kit/src/lib/i18n/en/index.ts +++ b/apps/kit/src/lib/i18n/en/index.ts @@ -20,7 +20,8 @@ const en: BaseTranslation = { createANewAccount: "create a new account", notMyComputer: "This is not my computer", resetPassword: "Reset password", - createYourNewAccount: "Create your new account" + createYourNewAccount: "Create your new account", + newPassword: "New password" }; export default en; diff --git a/apps/kit/src/lib/i18n/i18n-types.ts b/apps/kit/src/lib/i18n/i18n-types.ts index 3ace345..aedf48b 100644 --- a/apps/kit/src/lib/i18n/i18n-types.ts +++ b/apps/kit/src/lib/i18n/i18n-types.ts @@ -99,6 +99,10 @@ type RootTranslation = { * Create your new account */ createYourNewAccount: string + /** + * New password + */ + newPassword: string } export type NamespaceAppTranslation = { @@ -504,6 +508,10 @@ export type TranslationFunctions = { * Create your new account */ createYourNewAccount: () => LocalizedString + /** + * New password + */ + newPassword: () => LocalizedString app: { nav: { /** diff --git a/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.server.ts b/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.server.ts new file mode 100644 index 0000000..389d04c --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.server.ts @@ -0,0 +1,11 @@ +import { is_guid } from '$lib/helpers'; +import { redirect } from '@sveltejs/kit'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async ({ params }) => { + const resetRequestId = params.id ?? ""; + if (!is_guid(resetRequestId)) throw redirect(302, "/reset-password"); + return { + resetRequestId + }; +}; \ No newline at end of file diff --git a/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.svelte b/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.svelte new file mode 100644 index 0000000..7b46d2d --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/reset-password/[id]/+page.svelte @@ -0,0 +1,121 @@ + + +
+ {#if finishedPreliminaryLoading} +
+

+ {$LL.requestAPasswordReset()} +

+

+ {$LL.or().toLowerCase()} + + {$LL.signIntoYourAccount()} + +

+
+ +
+
+
+ + + + + +
+
+ {:else} +

Checking your request...

+ {/if} +
-- cgit v1.3