Commit f9e4a5c9 authored by alexpott's avatar alexpott

Issue #2453491 by olafkarsten, devpreview, mgifford, webflo: Account form username

parent ede2b8a2
...@@ -106,7 +106,7 @@ public function form(array $form, FormStateInterface $form_state) { ...@@ -106,7 +106,7 @@ public function form(array $form, FormStateInterface $form_state) {
'autocapitalize' => 'off', 'autocapitalize' => 'off',
'spellcheck' => 'false', 'spellcheck' => 'false',
), ),
'#default_value' => (!$register ? $account->getUsername() : ''), '#default_value' => (!$register ? $account->getAccountName() : ''),
'#access' => ($register || ($user->id() == $account->id() && $user->hasPermission('change own username')) || $admin), '#access' => ($register || ($user->id() == $account->id() && $user->hasPermission('change own username')) || $admin),
); );
......
...@@ -25,6 +25,13 @@ function testUserEdit() { ...@@ -25,6 +25,13 @@ function testUserEdit() {
$this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save')); $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
$this->assertRaw(t('The username %name is already taken.', array('%name' => $edit['name']))); $this->assertRaw(t('The username %name is already taken.', array('%name' => $edit['name'])));
// Check that the default value in user name field
// is the raw value and not a formatted one.
\Drupal::state()->set('user_hooks_test_user_format_name_alter', TRUE);
\Drupal::service('module_installer')->install(['user_hooks_test']);
$this->drupalGet('user/' . $user1->id() . '/edit');
$this->assertFieldByName('name', $user1->getAccountName());
// Check that filling out a single password field does not validate. // Check that filling out a single password field does not validate.
$edit = array(); $edit = array();
$edit['pass[pass1]'] = ''; $edit['pass[pass1]'] = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment