Commit df0bde0a authored by alexpott's avatar alexpott

Issue #2297185 by alimac, cepinos, mhazy, adci_contributor, YesCT,...

Issue #2297185 by alimac, cepinos, mhazy, adci_contributor, YesCT, RavindraSingh, jeet09: 'Reset password' should be 'Set password' when no password given yet
parent 5430ac91
......@@ -72,13 +72,14 @@ public function getFormID() {
public function buildForm(array $form, FormStateInterface $form_state, AccountInterface $user = NULL, $expiration_date = NULL, $timestamp = NULL, $hash = NULL) {
if ($expiration_date) {
$form['message'] = array('#markup' => $this->t('<p>This is a one-time login for %user_name and will expire on %expiration_date.</p><p>Click on this button to log in to the site and change your password.</p>', array('%user_name' => $user->getUsername(), '%expiration_date' => $expiration_date)));
$form['#title'] = $this->t('Reset password');
}
else {
// No expiration for first time login.
$form['message'] = array('#markup' => $this->t('<p>This is a one-time login for %user_name.</p><p>Click on this button to log in to the site and change your password.</p>', array('%user_name' => $user->getUsername())));
$form['#title'] = $this->t('Set password');
}
$form['#title'] = 'Reset Password';
$form['user'] = array(
'#type' => 'value',
'#value' => $user,
......
......@@ -95,6 +95,7 @@ function testUserPasswordReset() {
// Check the one-time login page.
$this->assertText($this->account->getUsername(), 'One-time login page contains the correct username.');
$this->assertText(t('This login can be used only once.'), 'Found warning about one-time login.');
$this->assertTitle(t('Reset password | Drupal'), 'Page title is "Reset password".');
// Check successful login.
$this->drupalPostForm(NULL, NULL, t('Log in'));
......
......@@ -44,6 +44,9 @@ function testRegistrationWithEmailVerification() {
$accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
$new_user = reset($accounts);
$this->assertTrue($new_user->isActive(), 'New account is active after registration.');
$resetURL = user_pass_reset_url($new_user);
$this->drupalGet($resetURL);
$this->assertTitle(t('Set password | Drupal'), 'Page title is "Set password".');
// Allow registration by site visitors, but require administrator approval.
$config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
......
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