Skip to content

Commit

Permalink
fix(login): show unauthenticated error message rather than too-many-r…
Browse files Browse the repository at this point in the history
…equests (#1791)
  • Loading branch information
SelmaBergstrand authored Jan 23, 2025
1 parent f8a40c0 commit 1206061
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tavla/app/(admin)/components/Login/Email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,18 @@ function Email() {
const uid = await credential.user.getIdToken()
const error = await login(uid)
if (error && auth.currentUser) {
await sendEmailVerification(auth.currentUser)
try {
await sendEmailVerification(auth.currentUser)
} catch (e: unknown) {
// if email verification returns too-many-requests, verification email was sent very recently
// user should not be shown the too-many-requests feedback
if (
e instanceof FirebaseError &&
e.code != 'auth/too-many-requests'
) {
return getFormFeedbackForError(e)
}
}
return getFormFeedbackForError(error, email)
}
} catch (e: unknown) {
Expand Down

0 comments on commit 1206061

Please sign in to comment.