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

Closes #282 Allow login via username or email #283

Merged
merged 1 commit into from
Nov 4, 2018

Conversation

bukajsytlos
Copy link
Member

Closes #282 Allow login via username or email

@bukajsytlos bukajsytlos force-pushed the feature/282-login-via-email-username branch from af613ea to 80d49e4 Compare November 4, 2018 00:58
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = userRepository.findOneByLoginIgnoreCase(username)
.orElseThrow(() -> new UsernameNotFoundException("User could not be found: " + username));
public UserDetails loadUserByUsername(String usernameOrEmail) throws UsernameNotFoundException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont we still have accounts that have same email and username if compared to lowwer case how would that affect this code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well good question, but I would argue that emails should be CI and username was searched CI even before. So if there are two accounts with same email, they will fail to log. Let's hope they will contact mod :)

Copy link
Member

@Brutus5000 Brutus5000 Nov 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha interesting point: this is also an issue on password reset.
But I have checked, hibernate does not throw an exception.
Two email accounts per user are not wanted, so we will ban of the two users and then need to scrap their email address I guess.

Otherwise: if you have this issue, then just use your login name. All other cases are the user's own fault.

@Brutus5000 Brutus5000 merged commit 0752e01 into develop Nov 4, 2018
@bukajsytlos bukajsytlos deleted the feature/282-login-via-email-username branch November 9, 2018 22:47
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.

None yet

3 participants