Skip to content

Commit

Permalink
impr: authentication error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Feb 22, 2024
1 parent 34161dd commit c7e122f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion frontend/src/ts/controllers/account-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ async function signIn(): Promise<void> {
await loadUser(e.user);
})
.catch(function (error) {
console.error(error);
let message = error.message;
if (error.code === "auth/wrong-password") {
message = "Incorrect password";
Expand All @@ -341,6 +342,9 @@ async function signIn(): Promise<void> {
} else if (error.code === "auth/invalid-email") {
message =
"Invalid email format (make sure you are using your email to login - not your username)";
} else if (error.code === "auth/invalid-credential") {
message =
"Email/password is incorrect or your account does not have password authentication enabled.";
}
Notifications.add(message, -1);
LoginPage.hidePreloader();
Expand Down Expand Up @@ -392,7 +396,11 @@ async function signInWithGoogle(): Promise<void> {
message =
"Invalid email format (make sure you are using your email to login - not your username)";
} else if (error.code === "auth/popup-closed-by-user") {
message = "Popup closed by user";
// message = "Popup closed by user";
return;
} else if (error.code === "auth/user-cancelled") {
// message = "User refused to sign in";
return;
}
Notifications.add(message, -1);
LoginPage.hidePreloader();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/popups/google-sign-up-popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function show(credential: UserCredential): void {
async function hide(): Promise<void> {
if (isPopupVisible(wrapperId)) {
if (signedInUser !== undefined) {
Notifications.add("Sign up process canceled", 0, {
Notifications.add("Sign up process cancelled", 0, {
duration: 5,
});
LoginPage.hidePreloader();
Expand Down

0 comments on commit c7e122f

Please sign in to comment.