mirror of
https://github.com/immich-app/immich.git
synced 2026-03-08 11:07:25 +03:00
feat(web): automatically update user info (#5647)
* use svelte store * fix: websocket error when not authenticated * more routes
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import ChangePasswordForm from '$lib/components/forms/change-password-form.svelte';
|
||||
import FullscreenContainer from '$lib/components/shared-components/fullscreen-container.svelte';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { user } from '$lib/stores/user.store';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -16,12 +17,12 @@
|
||||
|
||||
<FullscreenContainer title={data.meta.title}>
|
||||
<p slot="message">
|
||||
Hi {data.user.name} ({data.user.email}),
|
||||
Hi {$user.name} ({$user.email}),
|
||||
<br />
|
||||
<br />
|
||||
This is either the first time you are signing into the system or a request has been made to change your password. Please
|
||||
enter the new password below.
|
||||
</p>
|
||||
|
||||
<ChangePasswordForm user={data.user} on:success={onSuccessHandler} />
|
||||
<ChangePasswordForm user={$user} on:success={onSuccessHandler} />
|
||||
</FullscreenContainer>
|
||||
|
||||
@@ -2,15 +2,15 @@ import { AppRoute } from '$lib/constants';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageLoad } from './$types';
|
||||
import { getSavedUser } from '$lib/stores/user.store';
|
||||
|
||||
export const load = (async () => {
|
||||
const user = await authenticate();
|
||||
if (!user.shouldChangePassword) {
|
||||
await authenticate();
|
||||
if (!getSavedUser().shouldChangePassword) {
|
||||
throw redirect(302, AppRoute.PHOTOS);
|
||||
}
|
||||
|
||||
return {
|
||||
user,
|
||||
meta: {
|
||||
title: 'Change Password',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user