removed unused legacy page

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2025-09-21 15:32:59 +02:00
parent f1c9cef492
commit c28265b89c
2 changed files with 2 additions and 90 deletions
+2 -2
View File
@@ -12,9 +12,9 @@ export const immediateResponseHandler = (apiResponse) => {
goto('/login');
window.location.reload();
}
// If the user must renew their password, move them to the renew password page
// If the user must renew their password, redirect to login
if (apiResponse.statusCode === 400 && apiResponse.error === 'New password required') {
goto('/login/reset-password');
goto('/login');
return;
}
return apiResponse;
@@ -1,88 +0,0 @@
<script>
import { API } from '$lib/api/api.js';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { UserService } from '$lib/service/user';
import FormButton from '$lib/components/FormButton.svelte';
import Form from '$lib/components/Form.svelte';
import SubHeadline from '$lib/components/SubHeadline.svelte';
import { addToast } from '$lib/store/toast';
import FormError from '$lib/components/FormError.svelte';
import PasswordField from '$lib/components/PasswordField.svelte';
import HeadTitle from '$lib/components/HeadTitle.svelte';
import ThemeToggle from '$lib/components/ThemeToggle.svelte';
import { setupTheme, setupOSThemeListener } from '$lib/theme.js';
// services
const api = API.instance;
const userService = UserService.instance;
// bindings
const changePasswordFormValues = {
currentPassword: null,
newPassword: null,
repeatNewPassword: null
};
// local state
let changePasswordError = '';
// component logic
// hooks
onMount(() => {
// initialize theme system
setupTheme();
setupOSThemeListener();
console.log('no implemented');
location.href = '/login';
});
// component logic
const onSubmitChangePassword = async () => {
changePasswordError = '';
// check if the new password and repeated password match
if (changePasswordFormValues.newPassword !== changePasswordFormValues.repeatNewPassword) {
changePasswordError = 'Current and repeated password do not match.';
return;
}
try {
const res = await api.user.changePassword(
changePasswordFormValues.currentPassword,
changePasswordFormValues.newPassword
);
if (!res.success) {
changePasswordError = res.error;
return;
}
addToast('Password changed - login required', 'Success');
userService.clear();
console.info('profile: changed password - navigating to login');
goto('/login/');
} catch (e) {
addToast('Failed to change password', 'Error');
console.error('failed to change password', e);
}
};
</script>
<HeadTitle title="Change password" />
<main class="bg-white dark:bg-gray-900 transition-colors duration-200">
<!-- theme toggle -->
<div class="fixed top-3 right-6 z-50">
<ThemeToggle />
</div>
<Form on:submit={onSubmitChangePassword}>
<SubHeadline>Current password has expired. Set a new password</SubHeadline>
<PasswordField bind:value={changePasswordFormValues.currentPassword}
>Current password</PasswordField
>
<PasswordField bind:value={changePasswordFormValues.newPassword}>New password</PasswordField>
<PasswordField bind:value={changePasswordFormValues.repeatNewPassword}
>Repeat new password</PasswordField
>
<FormError message={changePasswordError} />
<FormButton>Change Password</FormButton>
</Form>
</main>