-
-
- Log in with Discord
-
+
+
+
+ Log in with Fediverse
+
+
+ Log in with Discord
+
+
+
+
+
+ {#if error}
+
+
+
+ {/if}
+
+
+
+
+
-
-
+
+
+ Choose an authentication provider to get started. You can add more providers later.
+
diff --git a/frontend/src/routes/auth/login/discord/+page.svelte b/frontend/src/routes/auth/login/discord/+page.svelte
index 9ece471..93d2d76 100644
--- a/frontend/src/routes/auth/login/discord/+page.svelte
+++ b/frontend/src/routes/auth/login/discord/+page.svelte
@@ -8,6 +8,7 @@
import { userStore } from "$lib/store";
import type { PageData } from "./$types";
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
+ import { addToast } from "$lib/toast";
interface SignupResponse {
user: MeUser;
@@ -21,6 +22,7 @@
localStorage.setItem("pronouns-token", data.token);
localStorage.setItem("pronouns-user", JSON.stringify(data.user));
userStore.set(data.user);
+ addToast({ header: "Logged in", body: "Successfully logged in!" });
goto("/");
}
});
@@ -42,6 +44,7 @@
localStorage.setItem("pronouns-token", resp.token);
localStorage.setItem("pronouns-user", JSON.stringify(resp.user));
userStore.set(resp.user);
+ addToast({ header: "Welcome!", body: "Signed up successfully!" });
goto("/");
} catch (e) {
data.error = e as APIError;
diff --git a/frontend/src/routes/edit/profile/+page.svelte b/frontend/src/routes/edit/profile/+page.svelte
index 1f4a738..faec515 100644
--- a/frontend/src/routes/edit/profile/+page.svelte
+++ b/frontend/src/routes/edit/profile/+page.svelte
@@ -33,6 +33,7 @@
const MAX_AVATAR_BYTES = 1_000_000;
if (!$userStore) {
+ addToast({ header: "Error", body: "You are not logged in." });
goto("/");
}
@@ -55,16 +56,9 @@
let modified = false;
- $: redirectIfNoAuth($userStore);
$: modified = isModified(bio, display_name, links, names, pronouns, fields, avatar);
$: getAvatar(avatar_files).then((b64) => (avatar = b64));
- const redirectIfNoAuth = (user: MeUser | null) => {
- if (!user) {
- goto("/");
- }
- };
-
const isModified = (
bio: string,
display_name: string,
diff --git a/frontend/src/routes/settings/+layout.svelte b/frontend/src/routes/settings/+layout.svelte
index 005502f..3a94058 100644
--- a/frontend/src/routes/settings/+layout.svelte
+++ b/frontend/src/routes/settings/+layout.svelte
@@ -4,6 +4,7 @@
import { Button, ListGroup, ListGroupItem, Modal, ModalBody, ModalFooter } from "sveltestrap";
import { userStore } from "$lib/store";
import { goto } from "$app/navigation";
+ import { addToast } from "$lib/toast";
export let data: LayoutData;
@@ -15,6 +16,8 @@
localStorage.removeItem("pronouns-token");
localStorage.removeItem("pronouns-user");
toggle();
+
+ addToast({ header: "Logged out", body: "Successfully logged out!" });
goto("/");
};
diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte
index e7d0390..65bc0a1 100644
--- a/frontend/src/routes/settings/+page.svelte
+++ b/frontend/src/routes/settings/+page.svelte
@@ -5,6 +5,7 @@
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
import FallbackImage from "$lib/components/FallbackImage.svelte";
import { userStore } from "$lib/store";
+ import { addToast } from "$lib/toast";
import { Button, Icon, Modal, ModalBody, ModalFooter, ModalHeader, Table } from "sveltestrap";
import type { PageData } from "./$types";
@@ -39,6 +40,7 @@
localStorage.removeItem("pronouns-token");
localStorage.removeItem("pronouns-user");
toggleDeleteOpen();
+ addToast({ header: "Deleted account", body: "Your account is now pending deletion." });
goto("/");
} catch (e) {
deleteUsername = "";