diff --git a/services/src/main/java/org/keycloak/userprofile/AbstractUserProfileProvider.java b/services/src/main/java/org/keycloak/userprofile/AbstractUserProfileProvider.java index 1928771837..e9d2f77473 100644 --- a/services/src/main/java/org/keycloak/userprofile/AbstractUserProfileProvider.java +++ b/services/src/main/java/org/keycloak/userprofile/AbstractUserProfileProvider.java @@ -83,9 +83,6 @@ public abstract class AbstractUserProfileProvider case ACCOUNT_OLD: case ACCOUNT: case UPDATE_PROFILE: - if (realm.isRegistrationEmailAsUsername()) { - return false; - } return realm.isEditUsernameAllowed(); case UPDATE_EMAIL: return realm.isRegistrationEmailAsUsername(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountRestServiceTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountRestServiceTest.java index f9f68bf486..f3fe056441 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountRestServiceTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountRestServiceTest.java @@ -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);