Skip to content

Commit

Permalink
impr(login page): better error message (Estifanos12) (#5244)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Estifanos12 authored Mar 23, 2024
1 parent e52cdef commit abbed32
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion frontend/src/ts/controllers/account-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit abbed32

Please sign in to comment.