Permalink
Browse files

MDL-23692 forgotpw:adhere to site autocomp setting

  • Loading branch information...
peterbulmer committed Oct 7, 2013
1 parent 2f0dd8d commit 60a67d78e865b4184e40861b9507338faea3fe3e
Showing with 9 additions and 3 deletions.
  1. +9 −3 login/set_password_form.php
@@ -43,13 +43,19 @@ class login_set_password_form extends moodleform {
*/
public function definition() {
global $USER, $CFG;
+ // Prepare a string showing whether the site wants login password autocompletion to be available to user.
+ if (empty($CFG->loginpasswordautocomplete)) {
+ $autocomplete = 'autocomplete="on"';
+ } else {
+ $autocomplete = '';
+ }
$mform = $this->_form;
$mform->setDisableShortforms(true);
$mform->addElement('header', 'setpassword', get_string('setpassword'), '');
// Include the username in the form so browsers will recognise that a password is being set.
- $mform->addElement('text', 'username', '', 'style="display: none;" autocomplete="on"');
+ $mform->addElement('text', 'username', '', 'style="display: none;" ' . $autocomplete);
$mform->setType('username', PARAM_RAW);
// Token gives authority to change password.
$mform->addElement('hidden', 'token', '');
@@ -61,12 +67,12 @@ public function definition() {
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
- $mform->addElement('password', 'password', get_string('newpassword'), 'autocomplete="on"');
+ $mform->addElement('password', 'password', get_string('newpassword'), $autocomplete);
$mform->addRule('password', get_string('required'), 'required', null, 'client');
$mform->setType('password', PARAM_RAW);
$strpasswordagain = get_string('newpassword') . ' (' . get_string('again') . ')';
- $mform->addElement('password', 'password2', $strpasswordagain, 'autocomplete="on"');
+ $mform->addElement('password', 'password2', $strpasswordagain, $autocomplete);
$mform->addRule('password2', get_string('required'), 'required', null, 'client');
$mform->setType('password2', PARAM_RAW);

0 comments on commit 60a67d7

Please sign in to comment.