From b7e39b59fd0fc7b5610ebff29035bf622079e0d8 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Wed, 5 Oct 2022 20:45:21 +0800
Subject: refactor: Change file structure

---
 old-apps/portal/src/app/pages/forgot.svelte | 102 ----------------------------
 1 file changed, 102 deletions(-)
 delete mode 100644 old-apps/portal/src/app/pages/forgot.svelte

(limited to 'old-apps/portal/src/app/pages/forgot.svelte')

diff --git a/old-apps/portal/src/app/pages/forgot.svelte b/old-apps/portal/src/app/pages/forgot.svelte
deleted file mode 100644
index 156deab..0000000
--- a/old-apps/portal/src/app/pages/forgot.svelte
+++ /dev/null
@@ -1,102 +0,0 @@
-<script>
-	import {onMount} from "svelte";
-	import {link} from "svelte-spa-router";
-	import {create_forgot_password_request} from "$shared/lib/api/user";
-	import {is_email} from "$shared/lib/helpers";
-	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";
-
-	let isLoading = false;
-	let username;
-
-	const 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() {
-		return is_email(username);
-	}
-
-	async function submit_form() {
-		if (isLoading) {
-			return;
-		}
-		if (is_valid()) {
-			isLoading = true;
-			const response = await create_forgot_password_request(username);
-			if (response.ok) {
-				alert.show("success", {
-					title: "Request is sent",
-					text: "If we find an account associated with this email address, you will receive an email with a reset link very soon.",
-				});
-			} else {
-				console.error(response.data);
-				alert.show("error", {
-					title: response.data?.title ?? "An error occured",
-					text: response.data?.text ?? "Please try again soon",
-				});
-			}
-		}
-	}
-
-	onMount(() => {
-		document.addEventListener("DOMContentLoaded", () => {
-			document.getElementById("email-address").focus();
-		});
-	});
-</script>
-
-<Layout>
-    <Tile>
-        <form on:submit|preventDefault={submit_form}
-              class="max-width-xxs">
-            <fieldset>
-                <legend class="form-legend">
-                    <span class="margin-bottom-xs text-xl">Send reset link</span> <br/>
-                    <span class="text-sm">... or <a href="/login"
-                                                    use:link>log in</a></span>
-                </legend>
-                <div class="margin-bottom-xs">
-                    <p>Provide your email address, and we'll send you a link to set your new password.</p>
-                </div>
-                <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="email"
-                           id="email-address"
-                           placeholder="Email address"
-                           class="form-control width-100%"
-                           bind:value={username}/>
-                </div>
-                <div class="flex justify-end">
-                    <Button text="Send reset link"
-                            type="primary"
-                            loading={isLoading}/>
-                </div>
-            </fieldset>
-        </form>
-    </Tile>
-</Layout>
-- 
cgit v1.3

