Verified Commit 85700fc5 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3376314 by Spokje, urvashi_vora, catch, lauriii, ckrina, bostonjillian:...

Issue #3376314 by Spokje, urvashi_vora, catch, lauriii, ckrina, bostonjillian: Remove the username and password descriptions from the login form
parent 1f9798dd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -179,11 +179,11 @@ public function testStringTranslation() {
    // Test invalidation of 'rendered' cache tag after string translation.
    $this->drupalLogout();
    $this->drupalGet('xx/user/login');
    $this->assertSession()->pageTextContains('Enter the password that accompanies your username.');
    $this->assertSession()->pageTextContains('Password');

    $this->drupalLogin($translate_user);
    $search = [
      'string' => 'accompanies your username',
      'string' => 'Password',
      'langcode' => $langcode,
      'translation' => 'untranslated',
    ];
@@ -192,14 +192,14 @@ public function testStringTranslation() {
    $textarea = $this->assertSession()->elementExists('xpath', '//textarea');
    $lid = $textarea->getAttribute('name');
    $edit = [
      $lid => 'Enter your Llama username.',
      $lid => 'Llamas are larger than frogs.',
    ];
    $this->drupalGet('admin/config/regional/translate');
    $this->submitForm($edit, 'Save translations');

    $this->drupalLogout();
    $this->drupalGet('xx/user/login');
    $this->assertSession()->pageTextContains('Enter your Llama username.');
    $this->assertSession()->pageTextContains('Llamas are larger than frogs.');

    // Delete the language.
    $this->drupalLogin($admin_user);
+0 −2
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
      '#title' => $this->t('Username'),
      '#size' => 60,
      '#maxlength' => UserInterface::USERNAME_MAX_LENGTH,
      '#description' => $this->t('Enter your @s username.', ['@s' => $config->get('name')]),
      '#required' => TRUE,
      '#attributes' => [
        'autocorrect' => 'none',
@@ -123,7 +122,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
      '#type' => 'password',
      '#title' => $this->t('Password'),
      '#size' => 60,
      '#description' => $this->t('Enter the password that accompanies your username.'),
      '#required' => TRUE,
    ];

+0 −7
Original line number Diff line number Diff line
@@ -85,13 +85,6 @@ protected function blockAccess(AccountInterface $account) {
  public function build() {
    $form = \Drupal::formBuilder()->getForm('Drupal\user\Form\UserLoginForm');
    unset($form['name']['#attributes']['autofocus']);
    // When unsetting field descriptions, also unset aria-describedby attributes
    // to avoid introducing an accessibility bug.
    // @todo Do this automatically in https://www.drupal.org/node/2547063.
    unset($form['name']['#description']);
    unset($form['name']['#attributes']['aria-describedby']);
    unset($form['pass']['#description']);
    unset($form['pass']['#attributes']['aria-describedby']);
    $form['name']['#size'] = 15;
    $form['pass']['#size'] = 15;