feat(frontend): remove auth method

This commit is contained in:
sam 2025-02-11 14:21:40 +01:00
parent 373d97e70a
commit c47fc41437
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 121 additions and 6 deletions

View file

@ -0,0 +1,14 @@
<script lang="ts">
import { t } from "$lib/i18n";
type Props = { data?: { alertKey?: string }; key?: string };
let props: Props = $props();
let key = $derived(props.key ?? props.data?.alertKey);
</script>
{#if key}
<div class="alert alert-light">
{$t(key)}
</div>
{/if}

View file

@ -77,7 +77,16 @@
"log-in-sign-up-link": "Sign up with email",
"forgot-password-title": "Forgot password",
"reset-password-title": "Reset password",
"password-changed-hint": "Your password has been changed!"
"password-changed-hint": "Your password has been changed!",
"link-email-header": "Link a new email address",
"unlink-email-header": "Unlink email address",
"unlink-fediverse-header": "Unlink fediverse account",
"unlink-tumblr-header": "Unlink Tumblr account",
"unlink-google-header": "Unlink Google account",
"unlink-discord-header": "Unlink Discord account",
"unlink-confirmation-1": "Are you sure you want to unlink {{username}} from your account?",
"unlink-confirmation-2": "You will no longer be able to use this account to log in. Please make sure at least one of your other linked accounts is accessible before continuing.",
"unlink-button": "Unlink account"
},
"error": {
"bad-request-header": "Something was wrong with your input",
@ -310,5 +319,8 @@
"form": {
"optional": "(optional)",
"required": "Required"
},
"alert": {
"auth-method-remove-success": "Successfully unlinked account!"
}
}

View file

@ -9,9 +9,10 @@ export const setToken = (cookies: Cookies, token: string) =>
cookies.set(TOKEN_COOKIE_NAME, token, { path: "/" });
export const clearToken = (cookies: Cookies) => cookies.delete(TOKEN_COOKIE_NAME, { path: "/" });
// TODO: change this to something we actually clearly have the rights to use
export const DEFAULT_AVATAR = "https://pronouns.cc/default/512.webp";
export const DEFAULT_FLAG = "/unknown_flag.svg";
export const idTimestamp = (id: string) =>
DateTime.fromMillis(parseInt(id, 10) / (1 << 22) + 1_640_995_200_000);
export const alertKey = (url: URL): string | undefined =>
url.searchParams.has("alert") ? "alert." + url.searchParams.get("alert") : undefined;