mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'wip_MDL-48665_m29_pwrot' of https://github.com/skodak/moodle
This commit is contained in:
commit
ac38af7f3f
2 changed files with 6 additions and 5 deletions
|
@ -217,7 +217,7 @@ function core_login_process_password_set($token) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Token is correct, and unexpired.
|
// Token is correct, and unexpired.
|
||||||
$mform = new login_set_password_form(null, null, 'post', '', 'autocomplete="yes"');
|
$mform = new login_set_password_form(null, $user, 'post', '', 'autocomplete="yes"');
|
||||||
$data = $mform->get_data();
|
$data = $mform->get_data();
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
// User hasn't submitted form, they got here directly from email link.
|
// User hasn't submitted form, they got here directly from email link.
|
||||||
|
|
|
@ -43,7 +43,7 @@ class login_set_password_form extends moodleform {
|
||||||
* Define the set password form.
|
* Define the set password form.
|
||||||
*/
|
*/
|
||||||
public function definition() {
|
public function definition() {
|
||||||
global $USER, $CFG;
|
global $CFG;
|
||||||
// Prepare a string showing whether the site wants login password autocompletion to be available to user.
|
// Prepare a string showing whether the site wants login password autocompletion to be available to user.
|
||||||
if (empty($CFG->loginpasswordautocomplete)) {
|
if (empty($CFG->loginpasswordautocomplete)) {
|
||||||
$autocomplete = 'autocomplete="on"';
|
$autocomplete = 'autocomplete="on"';
|
||||||
|
@ -94,7 +94,8 @@ class login_set_password_form extends moodleform {
|
||||||
* @return array errors occuring during validation.
|
* @return array errors occuring during validation.
|
||||||
*/
|
*/
|
||||||
public function validation($data, $files) {
|
public function validation($data, $files) {
|
||||||
global $USER;
|
$user = $this->_customdata;
|
||||||
|
|
||||||
$errors = parent::validation($data, $files);
|
$errors = parent::validation($data, $files);
|
||||||
|
|
||||||
// Ignore submitted username.
|
// Ignore submitted username.
|
||||||
|
@ -111,9 +112,9 @@ class login_set_password_form extends moodleform {
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_is_previously_used_password($USER->id, $data['password'])) {
|
if (user_is_previously_used_password($user->id, $data['password'])) {
|
||||||
$errors['password'] = get_string('errorpasswordreused', 'core_auth');
|
$errors['password'] = get_string('errorpasswordreused', 'core_auth');
|
||||||
$errors['password2'] = get_string('passwordreused', 'core_auth');
|
$errors['password2'] = get_string('errorpasswordreused', 'core_auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue