1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

fix(web) prevent create multiple user when the instance is lagging (#882)

This commit is contained in:
Alex 2022-10-28 15:29:36 -05:00 committed by GitHub
parent ea99567805
commit b1212fc98b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,8 @@
let canCreateUser = false;
let isCreatingUser = false;
$: {
if (password !== confirmPassowrd && confirmPassowrd.length > 0) {
error = 'Password does not match';
@ -22,7 +24,9 @@
const dispatch = createEventDispatcher();
async function registerUser(event: SubmitEvent) {
if (canCreateUser) {
if (canCreateUser && !isCreatingUser) {
isCreatingUser = true;
error = '';
const formElement = event.target as HTMLFormElement;
@ -45,9 +49,12 @@
success = 'New user created';
dispatch('user-created');
isCreatingUser = false;
return;
} else {
error = 'Error create user account';
isCreatingUser = false;
}
}
}
@ -120,6 +127,7 @@
<button
type="submit"
class="m-4 bg-immich-primary dark:bg-immich-dark-primary hover:bg-immich-primary/75 dark:hover:bg-immich-dark-primary/80 px-6 py-3 text-white dark:text-immich-dark-gray rounded-full shadow-md w-full font-medium"
disabled={isCreatingUser}
>Create
</button>
</div>