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 1fe434664c
commit 963da364f0
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);