Skip to content

Commit

Permalink
MDL-55564 output: Use template for password autofill hack
Browse files Browse the repository at this point in the history
Part of MDL-55071
  • Loading branch information
Frederic Massart authored and danpoltawski committed Sep 23, 2016
1 parent d3c35f9 commit cd7a164
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions lib/templates/prevent_form_autofill_password.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Snippet to prevent browsers from autofilling password fields.
}}
<div class="hide">
<input type="text" class="ignoredirty" />
<input type="password" class="ignoredirty" />
</div>
3 changes: 2 additions & 1 deletion lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3744,5 +3744,6 @@ function get_formatted_help_string($identifier, $component, $ajax = false, $a =
* @return string HTML to prevent password autofill
*/
function prevent_form_autofill_password() {
return '<div class="hide"><input type="text" class="ignoredirty" /><input type="password" class="ignoredirty" /></div>';
global $OUTPUT;
return $OUTPUT->render_from_template('core/prevent_form_autofill_password', []);
}

0 comments on commit cd7a164

Please sign in to comment.