You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-16 07:24:40 +02:00
feat(web): allow admin to update email of users (#2189)
This commit is contained in:
@ -14,21 +14,12 @@
|
|||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const editUser = async (event: SubmitEvent) => {
|
const editUser = async () => {
|
||||||
try {
|
try {
|
||||||
const formElement = event.target as HTMLFormElement;
|
const { id, email, firstName, lastName } = user;
|
||||||
const form = new FormData(formElement);
|
const { status } = await api.userApi.updateUser({ id, email, firstName, lastName });
|
||||||
|
|
||||||
const firstName = form.get('firstName');
|
if (status === 200) {
|
||||||
const lastName = form.get('lastName');
|
|
||||||
|
|
||||||
const { status } = await api.userApi.updateUser({
|
|
||||||
id: user.id,
|
|
||||||
firstName: firstName?.toString(),
|
|
||||||
lastName: lastName?.toString()
|
|
||||||
});
|
|
||||||
|
|
||||||
if (status == 200) {
|
|
||||||
dispatch('edit-success');
|
dispatch('edit-success');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -79,13 +70,12 @@
|
|||||||
|
|
||||||
<form on:submit|preventDefault={editUser} autocomplete="off">
|
<form on:submit|preventDefault={editUser} autocomplete="off">
|
||||||
<div class="m-4 flex flex-col gap-2">
|
<div class="m-4 flex flex-col gap-2">
|
||||||
<label class="immich-form-label" for="email">Email (cannot change)</label>
|
<label class="immich-form-label" for="email">Email</label>
|
||||||
<input
|
<input
|
||||||
class="immich-form-input disabled:bg-gray-200 hover:cursor-not-allowed"
|
class="immich-form-input"
|
||||||
id="email"
|
id="email"
|
||||||
name="email"
|
name="email"
|
||||||
type="email"
|
type="email"
|
||||||
disabled
|
|
||||||
bind:value={user.email}
|
bind:value={user.email}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user