Issue #1952196 by greggles, sandhya.m: Usability: if a user has just failed a login, default their username on password reset.
parent
f746ed8ecc
commit
1b0d6d22d3
|
@ -1,6 +1,9 @@
|
|||
|
||||
Drupal 7.23, xxxx-xx-xx (development version)
|
||||
-----------------------
|
||||
- Changed the password reset form to pre-fill the username when requested via a
|
||||
URL query parameter, and used this in the error message that appears after a
|
||||
failed login attempt (minor data structure and behavior change).
|
||||
- Fixed broken support for foreign keys in the field API.
|
||||
- Fixed "No active batch" error when a user cancels their own account.
|
||||
- Added a description to the "access content overview" permission on the
|
||||
|
|
|
@ -2195,7 +2195,7 @@ function user_login_final_validate($form, &$form_state) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password'))));
|
||||
form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => array('name' => $form_state['values']['name']))))));
|
||||
watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_state['values']['name']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ function user_pass() {
|
|||
'#size' => 60,
|
||||
'#maxlength' => max(USERNAME_MAX_LENGTH, EMAIL_MAX_LENGTH),
|
||||
'#required' => TRUE,
|
||||
'#default_value' => isset($_GET['name']) ? $_GET['name'] : '',
|
||||
);
|
||||
// Allow logged in users to request this also.
|
||||
if ($user->uid > 0) {
|
||||
|
|
|
@ -501,6 +501,24 @@ class UserPasswordResetTestCase extends DrupalWebTestCase {
|
|||
$this->drupalGet("user/reset/$account->uid/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
|
||||
$this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefill the text box on incorrect login via link to password reset page.
|
||||
*/
|
||||
function testUserPasswordTextboxFilled() {
|
||||
$this->drupalGet('user/login');
|
||||
$edit = array(
|
||||
'name' => $this->randomName(),
|
||||
'pass' => $this->randomName(),
|
||||
);
|
||||
$this->drupalPost('user', $edit, t('Log in'));
|
||||
$this->assertRaw(t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>',
|
||||
array('@password' => url('user/password', array('query' => array('name' => $edit['name']))))));
|
||||
unset($edit['pass']);
|
||||
$this->drupalGet('user/password', array('query' => array('name' => $edit['name'])));
|
||||
$this->assertFieldByName('name', $edit['name'], 'User name found.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue