mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
Merge branch 'MDL-76478-password-unmask' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
3db03d69b5
@ -54,14 +54,19 @@ class MoodleQuickForm_password extends HTML_QuickForm_password implements templa
|
||||
*/
|
||||
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
|
||||
global $CFG;
|
||||
// no standard mform in moodle should allow autocomplete of passwords
|
||||
|
||||
// No standard mform in moodle should allow autocomplete of passwords.
|
||||
if (empty($attributes)) {
|
||||
$attributes = array('autocomplete'=>'off');
|
||||
$attributes = ['autocomplete' => 'new-password'];
|
||||
} else if (is_array($attributes) && empty($attributes['autocomplete'])) {
|
||||
$attributes['autocomplete'] = 'off';
|
||||
$attributes['autocomplete'] = 'new-password';
|
||||
} else if (is_array($attributes) && $attributes['autocomplete'] === 'off') {
|
||||
// A value of 'off' is ignored in all modern browsers and password
|
||||
// managers and should be new-password instead.
|
||||
$attributes['autocomplete'] = 'new-password';
|
||||
} else if (is_string($attributes)) {
|
||||
if (strpos($attributes, 'autocomplete') === false) {
|
||||
$attributes .= ' autocomplete="off" ';
|
||||
$attributes .= ' autocomplete="new-password" ';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,16 +52,6 @@ class MoodleQuickForm_passwordunmask extends MoodleQuickForm_password {
|
||||
* or an associative array
|
||||
*/
|
||||
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
|
||||
// no standard mform in moodle should allow autocomplete of passwords
|
||||
if (empty($attributes)) {
|
||||
$attributes = array('autocomplete'=>'off');
|
||||
} else if (is_array($attributes)) {
|
||||
$attributes['autocomplete'] = 'off';
|
||||
} else {
|
||||
if (strpos($attributes, 'autocomplete') === false) {
|
||||
$attributes .= ' autocomplete="off" ';
|
||||
}
|
||||
}
|
||||
$this->_persistantFreeze = true;
|
||||
|
||||
parent::__construct($elementName, $elementLabel, $attributes);
|
||||
|
@ -59,7 +59,7 @@
|
||||
{{# error }}
|
||||
autofocus aria-describedby="{{ element.iderror }}"
|
||||
{{/ error }}
|
||||
{{{ attributes }}}
|
||||
{{{ element.attributes }}}
|
||||
>
|
||||
</span>
|
||||
{{^ element.frozen }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user