mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-06 15:34:06 +08:00
impr: authentication error messages
This commit is contained in:
parent
34161ddffa
commit
c7e122f640
2 changed files with 10 additions and 2 deletions
|
|
@ -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";
|
||||
|
|
@ -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();
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue