From a9072370ca1eb9a5cce928b1d487db0f307edea6 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Tue, 20 Sep 2022 15:24:27 +0800
Subject: feat: Move old apps into it's own directory

---
 apps/portal/src/app/pages/reset-password.svelte | 138 ------------------------
 1 file changed, 138 deletions(-)
 delete mode 100644 apps/portal/src/app/pages/reset-password.svelte

(limited to 'apps/portal/src/app/pages/reset-password.svelte')

diff --git a/apps/portal/src/app/pages/reset-password.svelte b/apps/portal/src/app/pages/reset-password.svelte
deleted file mode 100644
index dabf5c9..0000000
--- a/apps/portal/src/app/pages/reset-password.svelte
+++ /dev/null
@@ -1,138 +0,0 @@
-<script>
-	import {querystring, link} from "svelte-spa-router";
-	import {check_forgot_password_request, fulfill_forgot_password_request} from "$shared/lib/api/user";
-	import Alert from "$shared/components/alert.svelte";
-	import Button from "$shared/components/button.svelte";
-	import Tile from "$shared/components/tile.svelte";
-	import Layout from "./_layout.svelte";
-
-	const requestId = new URLSearchParams($querystring).get("id");
-	let isLoading = false;
-	let newPassword;
-	let newPasswordError;
-	let alert = {
-		title: "",
-		type: "",
-		message: "",
-		isVisible: false,
-		show(type, obj) {
-			alert.title = obj.title;
-			alert.message = obj.text;
-			alert.type = type;
-			alert.isVisible = true;
-			isLoading = false;
-		},
-		hide() {
-			alert.isVisible = false;
-			alert.title = "";
-			alert.message = "";
-			alert.type = "";
-			isLoading = false;
-		},
-	};
-
-	function is_valid() {
-		let isValid = true;
-		if (!newPassword.length > 5) {
-			newPasswordError = "The new password must be at least 5 characters";
-			isValid = false;
-		}
-		return isValid;
-	}
-
-	async function submit() {
-		if (isLoading) {
-			return;
-		}
-		if (is_valid()) {
-			isLoading = true;
-			const response = await fulfill_forgot_password_request(requestId, newPassword);
-			if (response.ok) {
-				alert.show("success", {
-					title: "Your new password is set",
-					text: "<a href='/#/login'>Click here to log in</a>",
-				});
-			} else {
-				console.error(response.data);
-				alert.show("error", {
-					title: response.data?.title ?? "An error occured",
-					text: response.data?.text ?? "Please try again soon",
-				});
-			}
-		}
-	}
-
-	async function is_valid_password_reset_request() {
-		const response = await check_forgot_password_request(requestId);
-		if (response.ok) {
-			return response.data === true;
-		}
-		return false;
-	}
-</script>
-
-<Layout>
-    <Tile>
-        <form on:submit|preventDefault={submit}
-              class="max-width-xxs {isLoading ? 'c-disabled loading' : ''}">
-            {#if requestId}
-                {#await is_valid_password_reset_request()}
-                    <p>Checking your request...</p>
-                    <a href="/login"
-                       use:link>cancel</a>
-                {:then isActive}
-                    {#if isActive === true}
-                        <fieldset>
-                            <legend class="form-legend">
-                                <span class="margin-bottom-xs text-xl">Set your new password</span> <br/>
-                                <span class="text-sm">
-								... or
-								<a href="/login"
-                                   use:link> log in </a>
-							</span>
-                            </legend>
-                            <div class="margin-bottom-xxs max-width-xxs">
-                                <Alert visible={alert.isVisible}
-                                       title={alert.title}
-                                       message={alert.message}
-                                       type={alert.type}/>
-                            </div>
-                            <div class="margin-bottom-xs">
-                                <input
-                                        type="password"
-                                        id="new-password"
-                                        placeholder="New password"
-                                        class="form-control width-100%"
-                                        bind:value={newPassword}
-                                />
-                                {#if newPasswordError}
-                                    <small class="color-danger">{newPasswordError}</small>
-                                {/if}
-                            </div>
-                            <div class="flex justify-end">
-                                <Button text="Set new password"
-                                        type="primary"
-                                        loading={isLoading}
-                                        on:click={submit}/>
-                            </div>
-                        </fieldset>
-                    {:else}
-                        <Alert title="This request is expired"
-                               message="Please submit the forgot password form again"
-                               type="warning"/>
-                        <div class="flex justify-between width-100% margin-y-sm">
-                            <a href="/forgot"
-                               use:link>Go to forgot form</a>
-                            <a href="/login"
-                               use:link>Go to login form</a>
-                        </div>
-                    {/if}
-                {:catch _}
-                    <Alert title="An error occured"
-                           message="Please try again soon"
-                           type="error"/>
-                {/await}
-            {/if}
-        </form>
-    </Tile>
-</Layout>
-- 
cgit v1.3

