feat(frontend): force log out page

This commit is contained in:
sam 2024-12-02 16:32:13 +01:00
parent 54be457a47
commit f0ae648492
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 28 additions and 1 deletions

View file

@ -110,7 +110,9 @@
"username-update-success": "Successfully changed your username!",
"create-member-title": "Create a new member",
"create-member-name-label": "Member name",
"auth-remove-method": "Remove"
"auth-remove-method": "Remove",
"force-log-out-warning": "Make sure you're still able to log in before using this!",
"force-log-out-confirmation": "Are you sure you want to log out from all devices? If you just want to log out from this device, click the \"Log out\" button on your settings page."
},
"yes": "Yes",
"no": "No",

View file

@ -0,0 +1,11 @@
import { fastRequest } from "$api";
import { clearToken } from "$lib";
import { redirect } from "@sveltejs/kit";
export const actions = {
default: async ({ fetch, cookies }) => {
await fastRequest("POST", "/auth/force-log-out", { isInternal: true, fetch, cookies }, true);
clearToken(cookies);
redirect(303, "/");
},
};

View file

@ -0,0 +1,14 @@
<script lang="ts">
import { t } from "$lib/i18n";
</script>
<h3>{$t("settings.force-log-out-title")}</h3>
<p>
{$t("settings.force-log-out-confirmation")}
<strong>{$t("settings.force-log-out-warning")}</strong>
</p>
<form method="POST">
<button type="submit" class="btn btn-danger">{$t("settings.force-log-out-button")}</button>
</form>