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

Allow change of login casing #663

Merged
merged 1 commit into from
Oct 3, 2022
Merged

Conversation

vonagam
Copy link
Contributor

@vonagam vonagam commented Oct 3, 2022

Closes #662.

Copy link
Member

@Brutus5000 Brutus5000 left a comment

Choose a reason for hiding this comment

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

This is part of the validations, as such it should be in the validateUsername method. newLogin.equalsIgnoreCase(oldLogin) could cause an early return there before calling userRepository.existsByLogin

Also your PR should add a unit test for this case.

@vonagam
Copy link
Contributor Author

vonagam commented Oct 3, 2022

could cause an early return there before calling userRepository.existsByLogin

That's the point, if newLogin.equalsIgnoreCase(oldLogin) it means that it passes username rules and that existsByLogin will return true and cause false error raise, so it is ok to skip validateUsername call here.

All other calls to validateUsername do not deal with situations when a user already exists (and so no false errors from existsByLogin there).

Added the test. Have not run it though, not a java developer, so do not have an environment setup. If you want to move this logic to validateUsername with Optional second argument of an existing user, that makes sense too, close this PR in that case.

@Brutus5000 Brutus5000 merged commit c3215df into FAForever:develop Oct 3, 2022
@Brutus5000
Copy link
Member

Brutus5000 commented Oct 3, 2022

Ah shame on me. I thought the CI passed but it was just Codacy. Well... we'll see if the test works on develop :D

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.

Allow user change login/username with same value with different casing
2 participants