Repository navigation
Allow email as identifier on sign in - #656
Closed
btfcookies wants to merge 1 commit into
Closed
btfcookies wants to merge 1 commit into
btfcookies wants to merge 1 commit into
Conversation
Member
|
this diff is way too big, please clean it up |
Contributor
Author
|
ok sorry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
People have run into issues where they forgot their username but know the email they created their account with. I thought the best solution for this was to allow people to use an email as their identifier when signing in.
I did take into account that emails are intended to be kept private, so its only used in the lookup on signin. Email storage in mongodb was not touched.
Features
server/authentication.jstries to match a verified-email and falls back to the username.validateUsernamerejects @ to avoid confusion with emails.database/account-info/has a new fileget-verified-usernames-by-email.jsthat is a case insensitive lookup for usernamesroutes/auth/login.jsresolves the identifier before checking password and returns{expires, username}. Non string identifiers previously passed on this so they now return 400 (this was also true forroutes/auth/send-password-reset-email.jsso i changed it as well)routes/auth/verify-email.jsawaitsasync verifyEmailLinktools/create-user-indexes.jsaudits for duplicate verified emails and can write with--apply