From d18678f9030d5f6fed4ca3aff12001540968a10e Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 18:11:23 +0300 Subject: [PATCH 1/7] fix:create user email already exists message --- frontend/src/ts/controllers/account-controller.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index eb425dae38b6..066d21d45436 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -593,7 +593,10 @@ async function signUp(): Promise { } 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.code === "auth/email-already-in-use"){ + message = Misc.createErrorMessage({ message: "Email already exists"}, "Failed to create account"); + } Notifications.add(message, -1); LoginPage.hidePreloader(); LoginPage.enableInputs(); From 2de7f63b8f9277f5dac9f1f05bed2aba083d948a Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 18:39:25 +0300 Subject: [PATCH 2/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index 066d21d45436..da65afc1f053 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -593,9 +593,11 @@ async function signUp(): Promise { } Notifications.add("Account created", 1); } catch (e) { + let message = Misc.createErrorMessage(e, "Failed to create account"); + if(e.code === "auth/email-already-in-use"){ - message = Misc.createErrorMessage({ message: "Email already exists"}, "Failed to create account"); + message = Misc.createErrorMessage({message: "Email already exists"}, "Failed to create account"); } Notifications.add(message, -1); LoginPage.hidePreloader(); From 6b13c7d749398b5d44fa8abe2220bafee7dfeb02 Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 18:44:13 +0300 Subject: [PATCH 3/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index da65afc1f053..91d7cf7694ba 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -593,11 +593,13 @@ async function signUp(): Promise { } Notifications.add("Account created", 1); } catch (e) { - let message = Misc.createErrorMessage(e, "Failed to create account"); - - if(e.code === "auth/email-already-in-use"){ - message = Misc.createErrorMessage({message: "Email already exists"}, "Failed to create account"); + + if (e.code === "auth/email-already-in-use") { + message = Misc.createErrorMessage( + { message: "Email already exists" }, + "Failed to create account" + ); } Notifications.add(message, -1); LoginPage.hidePreloader(); From 9dfa8ac8127b03bff40a39d5cff65c8624fe9349 Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 18:49:54 +0300 Subject: [PATCH 4/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index 91d7cf7694ba..bd6a99b338b9 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -595,7 +595,7 @@ async function signUp(): Promise { } catch (e) { let message = Misc.createErrorMessage(e, "Failed to create account"); - if (e.code === "auth/email-already-in-use") { + if (e?.code === "auth/email-already-in-use") { message = Misc.createErrorMessage( { message: "Email already exists" }, "Failed to create account" From 295c6cb406f578cf4aef8dd6afdbeed3bd209f74 Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:15:02 +0300 Subject: [PATCH 5/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index bd6a99b338b9..ce016db326f3 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -595,12 +595,13 @@ async function signUp(): Promise { } catch (e) { let message = Misc.createErrorMessage(e, "Failed to create account"); - if (e?.code === "auth/email-already-in-use") { + if ("code" in e && e.code === "auth/email-already-in-use") { message = Misc.createErrorMessage( { message: "Email already exists" }, "Failed to create account" ); } + Notifications.add(message, -1); LoginPage.hidePreloader(); LoginPage.enableInputs(); From 40c099956d43451138e16e1d6cd9498984f806f9 Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:20:51 +0300 Subject: [PATCH 6/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index ce016db326f3..64f667c78548 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -595,11 +595,13 @@ async function signUp(): Promise { } catch (e) { let message = Misc.createErrorMessage(e, "Failed to create account"); - if ("code" in e && e.code === "auth/email-already-in-use") { - message = Misc.createErrorMessage( - { message: "Email already exists" }, - "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 exists" }, + "Failed to create account" + ); + } } Notifications.add(message, -1); From f7b83ff7b128e1cfe43932276c8506ca371f8fba Mon Sep 17 00:00:00 2001 From: Estifanos Gashawtena <88879001+Estifanos12@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:40:33 +0300 Subject: [PATCH 7/7] Update account-controller.ts --- frontend/src/ts/controllers/account-controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index 64f667c78548..6ead95eb417d 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -598,7 +598,7 @@ async function signUp(): Promise { if (e instanceof Error) { if ("code" in e && e.code === "auth/email-already-in-use") { message = Misc.createErrorMessage( - { message: "Email already exists" }, + { message: "Email already in use" }, "Failed to create account" ); }