Changing the email address has no impact at username regardless "Email as username" toggle

closes #20459
This commit is contained in:
Douglas Palmer 2023-05-23 10:44:07 -07:00 committed by Pedro Igor
parent df9cf53d2b
commit 1b8901f5a2
2 changed files with 4 additions and 3 deletions

View file

@ -83,9 +83,6 @@ public abstract class AbstractUserProfileProvider<U extends UserProfileProvider>
case ACCOUNT_OLD:
case ACCOUNT:
case UPDATE_PROFILE:
if (realm.isRegistrationEmailAsUsername()) {
return false;
}
return realm.isEditUsernameAllowed();
case UPDATE_EMAIL:
return realm.isRegistrationEmailAsUsername();

View file

@ -386,6 +386,10 @@ public class AccountRestServiceTest extends AbstractRestServiceTest {
user = updateAndGet(user);
assertEquals("test-user@localhost", user.getUsername());
user.setEmail("new@localhost");
user = updateAndGet(user);
assertEquals("new@localhost", user.getUsername());
realmRep.setRegistrationEmailAsUsername(false);
adminClient.realm("test").update(realmRep);