Skip to content
Snippets Groups Projects
Commit f9e4a5c9 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent ede2b8a2
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,7 @@ public function form(array $form, FormStateInterface $form_state) {
'autocapitalize' => 'off',
'spellcheck' => 'false',
),
'#default_value' => (!$register ? $account->getUsername() : ''),
'#default_value' => (!$register ? $account->getAccountName() : ''),
'#access' => ($register || ($user->id() == $account->id() && $user->hasPermission('change own username')) || $admin),
);
......
......@@ -25,6 +25,13 @@ function testUserEdit() {
$this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save'));
$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.
$edit = array();
$edit['pass[pass1]'] = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment