Allow changing case in usernames

This commit is contained in:
Nassim Jahnke 2023-04-22 23:37:18 +02:00
parent 5d4a526a92
commit 77b8fdef11
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -124,7 +124,7 @@ public class AuthService extends HangarComponent implements UserDetailsService {
@Transactional
public void handleUsernameChange(final UserTable user, final String newName) {
// make sure a user with that name doesn't exist yet
if (this.userDAO.getUserTable(newName) != null) {
if (this.userDAO.getUserTable(newName) != null && !user.getName().equalsIgnoreCase(newName)) {
throw new HangarApiException("That username is unavailable");
}
// check that last change was long ago