feat(frontend): force log out page
This commit is contained in:
parent
54be457a47
commit
f0ae648492
3 changed files with 28 additions and 1 deletions
|
@ -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",
|
||||
|
|
|
@ -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, "/");
|
||||
},
|
||||
};
|
|
@ -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>
|
Loading…
Reference in a new issue