refactor: improve code formatting and consistency in auth and login components
This commit is contained in:
parent
03664c61ba
commit
4feba703f7
2
frontend/src/types/user.d.ts
vendored
2
frontend/src/types/user.d.ts
vendored
@ -63,4 +63,4 @@ interface IRegexp {
|
||||
raw: string;
|
||||
}
|
||||
|
||||
type UserTheme = "light" | "dark" | "";
|
||||
type UserTheme = "light" | "dark" | "";
|
||||
|
||||
@ -24,7 +24,7 @@ export function parseToken(token: string) {
|
||||
const expiresAt = new Date(data.exp! * 1000);
|
||||
authStore.setLogoutTimer(
|
||||
window.setTimeout(() => {
|
||||
logout('inactivity');
|
||||
logout("inactivity");
|
||||
}, expiresAt.getTime() - Date.now())
|
||||
);
|
||||
}
|
||||
@ -113,16 +113,15 @@ export function logout(reason?: string) {
|
||||
if (noAuth) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
if(typeof reason === "string" && reason.trim() !== "") {
|
||||
router.push({
|
||||
path: "/login",
|
||||
query: { "logout-reason": reason }
|
||||
if (typeof reason === "string" && reason.trim() !== "") {
|
||||
router.push({
|
||||
path: "/login",
|
||||
query: { "logout-reason": reason },
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
router.push({
|
||||
path: "/login",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,9 @@
|
||||
<form @submit="submit">
|
||||
<img :src="logoURL" alt="File Browser" />
|
||||
<h1>{{ name }}</h1>
|
||||
<p v-if="reason != null" class="logout-message">{{t(`login.logout_reasons.${reason}`)}}</p>
|
||||
<p v-if="reason != null" class="logout-message">
|
||||
{{ t(`login.logout_reasons.${reason}`) }}
|
||||
</p>
|
||||
<div v-if="error !== ''" class="wrong">{{ error }}</div>
|
||||
|
||||
<input
|
||||
@ -71,7 +73,7 @@ const toggleMode = () => (createMode.value = !createMode.value);
|
||||
|
||||
const $showError = inject<IToastError>("$showError")!;
|
||||
|
||||
const reason = route.query['logout-reason'] ?? null;
|
||||
const reason = route.query["logout-reason"] ?? null;
|
||||
|
||||
const submit = async (event: Event) => {
|
||||
event.preventDefault();
|
||||
@ -127,4 +129,4 @@ onMounted(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user