From cd7a164bdfbd94b6015a4bd5681b1e3db7d77a36 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 16 Aug 2016 13:56:50 +0800 Subject: [PATCH] MDL-55564 output: Use template for password autofill hack Part of MDL-55071 --- .../prevent_form_autofill_password.mustache | 23 +++++++++++++++++++ lib/weblib.php | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lib/templates/prevent_form_autofill_password.mustache diff --git a/lib/templates/prevent_form_autofill_password.mustache b/lib/templates/prevent_form_autofill_password.mustache new file mode 100644 index 00000000000..307a0e4ac75 --- /dev/null +++ b/lib/templates/prevent_form_autofill_password.mustache @@ -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 . +}} +{{! + Snippet to prevent browsers from autofilling password fields. +}} +
+ + +
diff --git a/lib/weblib.php b/lib/weblib.php index f0a63d57b10..69160ab1003 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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 '
'; + global $OUTPUT; + return $OUTPUT->render_from_template('core/prevent_form_autofill_password', []); }