[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) {
|
public void setValues(UserRepresentation user) {
|
||||||
waitUntilElement(usernameInput).is().present();
|
waitUntilElement(usernameInput).is().present();
|
||||||
|
if (user.getUsername() != null) {
|
||||||
setUsername(user.getUsername());
|
setUsername(user.getUsername());
|
||||||
|
}
|
||||||
setEmail(user.getEmail());
|
setEmail(user.getEmail());
|
||||||
setFirstName(user.getFirstName());
|
setFirstName(user.getFirstName());
|
||||||
setLastName(user.getLastName());
|
setLastName(user.getLastName());
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.keycloak.testsuite.console.users;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.keycloak.representations.idm.RealmRepresentation;
|
||||||
import org.keycloak.representations.idm.UserRepresentation;
|
import org.keycloak.representations.idm.UserRepresentation;
|
||||||
import org.keycloak.testsuite.console.page.users.UserAttributes;
|
import org.keycloak.testsuite.console.page.users.UserAttributes;
|
||||||
|
|
||||||
|
@ -55,6 +56,17 @@ public class UserAttributesTest extends AbstractUserTest {
|
||||||
assertNull(usersPage.table().findUser(testUsername));
|
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
|
@Test
|
||||||
public void noUsername() {
|
public void noUsername() {
|
||||||
createUser(newTestRealmUser);
|
createUser(newTestRealmUser);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<!-- Characters >,<,/,\ are forbidden in username -->
|
<!-- Characters >,<,/,\ are forbidden in username -->
|
||||||
<input class="form-control" type="text" id="username" name="username" data-ng-model="user.username" autofocus
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue