mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
Added mechanism of required password change of new user's first login (#272)
* Deprecate login scenarios that support pre-web era * refactor and simplify setup * Added user info to change password form * change isFistLogin column to shouldChangePassword * Implemented change user password * Implement the change password page for mobile * Change label * Added changes log and up minor version * Fixed typo in the release note * Up server version
This commit is contained in:
@@ -1,74 +1,64 @@
|
||||
type AdminRegistrationResult = Promise<{
|
||||
error?: string
|
||||
success?: string
|
||||
user?: {
|
||||
email: string
|
||||
}
|
||||
}>
|
||||
|
||||
|
||||
error?: string;
|
||||
success?: string;
|
||||
user?: {
|
||||
email: string;
|
||||
};
|
||||
}>;
|
||||
|
||||
type LoginResult = Promise<{
|
||||
error?: string
|
||||
success?: string
|
||||
needUpdate?: boolean
|
||||
needSelectAdmin?: boolean
|
||||
user?: {
|
||||
accessToken: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
isAdmin: boolean
|
||||
id: string
|
||||
email: string
|
||||
}
|
||||
}>
|
||||
error?: string;
|
||||
success?: string;
|
||||
user?: {
|
||||
accessToken: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
isAdmin: boolean;
|
||||
id: string;
|
||||
email: string;
|
||||
shouldChangePassword: boolean;
|
||||
};
|
||||
}>;
|
||||
|
||||
type UpdateResult = Promise<{
|
||||
error?: string
|
||||
success?: string,
|
||||
user?: {
|
||||
accessToken: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
isAdmin: boolean
|
||||
id: string
|
||||
email: string
|
||||
}
|
||||
}>
|
||||
|
||||
error?: string;
|
||||
success?: string;
|
||||
user?: {
|
||||
accessToken: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
isAdmin: boolean;
|
||||
id: string;
|
||||
email: string;
|
||||
};
|
||||
}>;
|
||||
|
||||
export async function sendRegistrationForm(form: HTMLFormElement): AdminRegistrationResult {
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
});
|
||||
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
})
|
||||
|
||||
return await response.json()
|
||||
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
||||
export async function sendLoginForm(form: HTMLFormElement): LoginResult {
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
});
|
||||
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
})
|
||||
|
||||
return await response.json()
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
export async function sendUpdateForm(form: HTMLFormElement): UpdateResult {
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
});
|
||||
|
||||
const response = await fetch(form.action, {
|
||||
method: form.method,
|
||||
body: new FormData(form),
|
||||
headers: { accept: 'application/json' },
|
||||
})
|
||||
|
||||
return await response.json()
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user