[KEYCLOAK-13589] - Can't add user in admin console when 'Email as username' is enabled
This commit is contained in:
parent
2b3810606e
commit
9eeeb10587
3 changed files with 16 additions and 2 deletions
|
@ -113,7 +113,9 @@ public class UserAttributesForm extends Form {
|
|||
|
||||
public void setValues(UserRepresentation user) {
|
||||
waitUntilElement(usernameInput).is().present();
|
||||
setUsername(user.getUsername());
|
||||
if (user.getUsername() != null) {
|
||||
setUsername(user.getUsername());
|
||||
}
|
||||
setEmail(user.getEmail());
|
||||
setFirstName(user.getFirstName());
|
||||
setLastName(user.getLastName());
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.keycloak.testsuite.console.users;
|
|||
import org.jboss.arquillian.graphene.page.Page;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.representations.idm.RealmRepresentation;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.keycloak.testsuite.console.page.users.UserAttributes;
|
||||
|
||||
|
@ -55,6 +56,17 @@ public class UserAttributesTest extends AbstractUserTest {
|
|||
assertNull(usersPage.table().findUser(testUsername));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createUserEmailAsUserName() {
|
||||
RealmRepresentation representation = testRealmResource().toRepresentation();
|
||||
representation.setRegistrationEmailAsUsername(true);
|
||||
testRealmResource().update(representation);
|
||||
|
||||
newTestRealmUser.setEmail("test@keycloak.org");
|
||||
createUser(newTestRealmUser);
|
||||
assertAlertSuccess();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noUsername() {
|
||||
createUser(newTestRealmUser);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<div class="col-md-6">
|
||||
<!-- Characters >,<,/,\ are forbidden in username -->
|
||||
<input class="form-control" type="text" id="username" name="username" data-ng-model="user.username" autofocus
|
||||
required ng-pattern="/^[^\<\>\\\/]*$/" data-ng-readonly="!editUsername">
|
||||
data-ng-required="!emailAsUsername" ng-pattern="/^[^\<\>\\\/]*$/" data-ng-readonly="!editUsername">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue