Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix incorrect login notification #61

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

asanchezyali
Copy link
Contributor

@asanchezyali asanchezyali commented Aug 8, 2023

Update login notifications

Observations

  1. The switch-case structure for error codes was changed by object literal.
const mapAuthCodeToMessage: { [key: string]: string } = {
  "auth/wrong-password": "Password provided is not correct",
  "auth/invalid-password": "Password provided is not correct",
  "auth/invalid-email": "Email provided is invalid",
  "auth/invalid-display-name": "Display name provided is invalid",
  "auth/invalid-phone-number": "Phone number provided is invalid",
  "auth/invalid-photo-url": "Photo URL provided is invalid",
  "auth/invalid-uid": "UID provided is invalid",
  "auth/invalid-provider-id": "Provider ID provided is invalid",
  "auth/email-already-in-use": "Email provided is already in use",
  "auth/user-not-found": "User not found",
};
  1. The errors were propagated to the parent functions by reject. This looks like this for most cases:
   reject(new Error(mapAuthCodeToMessage[error.code] || "Something went wrong with your sign up process"));

@asanchezyali asanchezyali self-assigned this Aug 8, 2023
@asanchezyali asanchezyali force-pushed the asanchezyali/incorrect-login-notification branch from b6fe465 to 2829e2d Compare August 11, 2023 20:35
@asanchezyali asanchezyali marked this pull request as ready for review August 11, 2023 20:36
@juanArias8 juanArias8 merged commit 21ecbbd into main Aug 14, 2023
12 checks passed
@juanArias8 juanArias8 deleted the asanchezyali/incorrect-login-notification branch August 14, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect notification when logging in with a user that does not exist
2 participants