impr(login page): better error message (Estifanos12) (#5244)

* fix:create user email already exists message

* Update account-controller.ts

* Update account-controller.ts

* Update account-controller.ts

* Update account-controller.ts

* Update account-controller.ts

* Update account-controller.ts
This commit is contained in:
Estifanos Gashawtena 2024-03-23 13:07:15 +03:00 committed by GitHub
parent e52cdef46c
commit abbed321c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -591,7 +591,17 @@ async function signUp(): Promise<void> {
}
Notifications.add("Account created", 1);
} catch (e) {
const message = Misc.createErrorMessage(e, "Failed to create account");
let message = Misc.createErrorMessage(e, "Failed to create account");
if (e instanceof Error) {
if ("code" in e && e.code === "auth/email-already-in-use") {
message = Misc.createErrorMessage(
{ message: "Email already in use" },
"Failed to create account"
);
}
}
Notifications.add(message, -1);
LoginPage.hidePreloader();
LoginPage.enableInputs();