2 This file is part of Moodle - http://moodle.org/
4 Moodle is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Moodle is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 @template core_form/element-passwordunmask
20 Moodle passwordunmask form element template.
22 The purpose of this template is to render a passwordunmask form element.
24 Classes required for JS:
27 Data attributes required for JS:
30 Context variables required for this template:
37 Example context (json):
40 "id": "example_password_unmask",
42 "value": "Password1!",
48 {{< core_form/element-template }}
50 <span data-passwordunmask="wrapper" data-passwordunmaskid="{{ element.id }}">
51 <span data-passwordunmask="editor">
53 {{# element.frozen }}readonly{{/ element.frozen }}
54 {{^ element.hardfrozen}} name="{{ element.name }}"{{/ element.hardfrozen }}
56 value="{{ element.value }}"
57 class="form-control d-inline-block {{# error }}is-invalid{{/ error }}"
58 data-size="{{ element.size }}"
60 autofocus aria-describedby="{{ element.iderror }}"
66 <a href="#" data-passwordunmask="edit" title="{{ edithint }}">
68 <span data-passwordunmask="displayvalue">{{> core_form/element-passwordunmask-fill }}</span>
70 {{# pix }} t/passwordunmask-edit, core, {{# str }} passwordunmaskedithint, form {{/ str }}{{/ pix }}
73 <a href="#" data-passwordunmask="unmask" title="{{ unmaskhint }}">
74 {{# pix }} t/passwordunmask-reveal, core, {{# str }} passwordunmaskrevealhint, form {{/ str }}{{/ pix }}
76 <span data-passwordunmask="instructions" class="form-text text-muted" style="display: none;">
78 {{# str }} passwordunmaskinstructions, form {{/ str }}
83 {{/ core_form/element-template }}
85 require(['core_form/passwordunmask'], function(PasswordUnmask) {
86 new PasswordUnmask("{{ element.id }}");