-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add ability to login using email or username alike #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @adri thanks again! You made a good choice keeping the API as is, it will reduce the complexity of implementing the frontend.
Beside the confusion between name
and username
fields, I have nothing more to add to this PR. Good job 😉
def get_user_for_email_or_name_password(email_or_name, password) do | ||
user = | ||
User | ||
|> where([u], u.email == ^email_or_name or u.name == ^email_or_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User
schema fields may be confusing. name
is meant to store User's real name and is optional. The field you're looking for is u.username which is not nullable and unique among users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops good one. Thanks! Fixed :)
To avoid complexity in the frontend, the email field is used for logging in with email or username.
398fd4f
to
addbe03
Compare
To avoid complexity in the frontend, the
email
field is used forlogging in with email or username.
Fixes #9.