Automatically generated installer lang files
[moodle.git] / lib / templates / loginform.mustache
blobd563f5a43adba41fef053a076ace344fa7bc2c46
1 {{!
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/>.
17 {{!
18     @template core/loginform
20     Moodle template for the login page.
22     Context variables required for this template:
23     * autofocusform: Auto focus on form ?,
24     * canloginasguest - Is guest login allowed?,
25     * canloginbyemail - Is login by email allowed?,
26     * cansignup - Signup allowed?,
27     * cookieshelpicon - cookies help icon details
28     * error - Any errors in the form?,
29     * forgotpasswordurl - Forgot password url,
30     * hasidentityproviders - Flag, set to true to hide identity providers,
31     * hasinstructions - Flag, set to true to show instructions,
32     * identityproviders - List of identiy providers,
33     * instructions - Instructions,
34     * instructionsformat - Format of instructions,
35     * loginurl - Login url,
36     * signupurl - Signup url,
37     * errorformatted - Formatted error,
38     * logourl - Flag, logo url,
39     * sitename - Name of site.,
40     * logintoken - Random token to protect login request.,
41     * maintenance - Maintenance message
43     Example context (json):
44     {
45         "autofocusform": false,
46         "canloginasguest": "1",
47         "canloginbyemail": false,
48         "cansignup": true,
49         "cookieshelpicon": {
50             "heading": "Cookies must be enabled in your browser",
51             "text": "<div class=\"no-overflow\">Two cookies are used on this site. Both died..</div>",
52             "icon": {
53                 "attributes": [
54                     {
55                         "name": "class",
56                         "value": "iconhelp"
57                     },
58                     {
59                         "name": "alt",
60                         "value": "Help with Cookies must be enabled in your browser"
61                     },
62                     {
63                         "name": "title",
64                         "value": "Help with Cookies must be enabled in your browser"
65                     },
66                     {
67                         "name": "src",
68                         "value": "http://localhost/stable_master/theme/image.php?theme=boost&component=core&image=help"
69                     }
70                 ]
71             },
72             "linktext": null,
73             "title": "Help with Cookies must be enabled in your browser",
74             "url": "http://localhost/stable_master/help.php?component=core&identifier=cookiesenabled&lang=en",
75             "ltr": true
76         },
77         "error": "",
78         "forgotpasswordurl": "http://localhost/stable_master/login/forgot_password.php",
79         "hasidentityproviders": false,
80         "hasinstructions": true,
81         "identityproviders": [],
82         "instructions": "For full access to this site, you first need to create an account.",
83         "instructionsformat": "1",
84         "loginurl": "http://localhost/stable_master/login/index.php",
85         "signupurl": "http://localhost/stable_master/login/signup.php",
86         "cookieshelpiconformatted": "",
87         "errorformatted": "",
88         "logourl": false,
89         "sitename": "Beer & Chips",
90         "logintoken": "randomstring",
91         "maintenance": "For full access to this site, you need to login in as an admin.",
92         "languagemenu": "Choose language"
93     }
96 <div class="loginform">
97     {{#logourl}}
98         <div id="loginlogo" class="login-logo">
99             <img id="logoimage" src="{{logourl}}" class="img-fluid" alt="{{sitename}}"/>
100             <h1 class="login-heading sr-only">{{#str}} loginto, core, {{sitename}} {{/str}}</h1>
101         </div>
102     {{/logourl}}
103     {{^logourl}}
104         <h1 class="login-heading mb-4">{{#str}} loginto, core, {{sitename}} {{/str}}</h1>
105     {{/logourl}}
106     {{#maintenance}}
107         <div class="alert alert-danger login-maintenance">
108             {{{maintenance}}}
109         </div>
110     {{/maintenance}}
111     {{#error}}
112         <a href="#" id="loginerrormessage" class="sr-only">{{error}}</a>
113         <div class="alert alert-danger" role="alert">{{error}}</div>
114     {{/error}}
115     {{#cansignup}}
116         <a href="{{signupurl}}" class="sr-only">{{#str}} tocreatenewaccount {{/str}}</a>
117     {{/cansignup}}
118     <form class="login-form" action="{{loginurl}}" method="post" id="login">
119         <input type="hidden" name="logintoken" value="{{logintoken}}">
120         <div class="login-form-username form-group">
121             <label for="username" class="sr-only">
122                 {{^canloginbyemail}}
123                     {{#str}} username {{/str}}
124                 {{/canloginbyemail}}
125                 {{#canloginbyemail}}
126                     {{#str}} usernameemail {{/str}}
127                 {{/canloginbyemail}}
128             </label>
129             <input type="text" name="username" id="username" {{!
130                 !}}class="form-control form-control-lg" {{!
131                 !}}value="{{username}}" {{!
132                 !}}placeholder="{{^canloginbyemail}}{{#cleanstr}}username{{/cleanstr}}{{/canloginbyemail}}{{!
133                 !}}{{#canloginbyemail}}{{#cleanstr}}usernameemail{{/cleanstr}}{{/canloginbyemail}}" {{!
134                 !}}autocomplete="username">
135         </div>
136         <div class="login-form-password form-group">
137             <label for="password" class="sr-only">{{#str}} password {{/str}}</label>
138             <input type="password" name="password" id="password" value="" {{!
139                 !}}class="form-control form-control-lg" {{!
140                 !}}placeholder="{{#cleanstr}}password{{/cleanstr}}" {{!
141                 !}}autocomplete="current-password">
142         </div>
143         <div class="login-form-submit form-group">
144             <button class="btn btn-primary btn-lg" type="submit" id="loginbtn">{{#str}}login{{/str}}</button>
145         </div>
146         <div class="login-form-forgotpassword form-group">
147             <a href="{{forgotpasswordurl}}">{{#str}}forgotaccount{{/str}}</a>
148         </div>
149     </form>
150     {{#hasidentityproviders}}
151         <div class="login-divider"></div>
152         <div class="login-identityproviders">
153             <h2 class="login-heading">{{#str}} potentialidps, auth {{/str}}</h2>
154             {{#identityproviders}}
155                 <a class="btn login-identityprovider-btn btn-block" href="{{url}}">
156                     {{#iconurl}}
157                         <img src="{{iconurl}}" alt="" width="24" height="24"/>
158                     {{/iconurl}}
159                     {{name}}
160                 </a>
161             {{/identityproviders}}
162         </div>
163     {{/hasidentityproviders}}
164     {{#hasinstructions}}
165         <div class="login-divider"></div>
166         <div class="login-instructions {{#cansignup}}mb-3{{/cansignup}}">
167             <h2 class="login-heading">{{#str}}firsttime{{/str}}</h2>
168             {{{instructions}}}
169         </div>
170     {{/hasinstructions}}
171     {{#cansignup}}
172         <div class="login-signup">
173             <a class="btn btn-secondary" href="{{signupurl}}">{{#str}}startsignup{{/str}}</a>
174         </div>
175     {{/cansignup}}
176     {{#canloginasguest}}
177         <div class="login-divider"></div>
178         <h2 class="login-heading">{{#str}}someallowguest{{/str}}</h2>
179         <form action="{{loginurl}}" method="post" id="guestlogin">
180             <input type="hidden" name="logintoken" value="{{logintoken}}">
181             <input type="hidden" name="username" value="guest" />
182             <input type="hidden" name="password" value="guest" />
183             <button class="btn btn-secondary" type="submit">{{#str}}loginguest{{/str}}</button>
184         </form>
185     {{/canloginasguest}}
186     <div class="login-divider"></div>
187     <div class="d-flex">
188         {{#languagemenu}}
189             <div class="login-languagemenu">
190                 {{>core/action_menu}}
191             </div>
192             <div class="divider border-left align-self-center mx-3"></div>
193         {{/languagemenu}}
194         <button type="button" class="btn btn-secondary" {{!
195         }} data-modal="alert"{{!
196         }} data-modal-title-str='["cookiesenabled", "core"]' {{!
197         }} data-modal-content-str='["cookiesenabled_help_html", "core"]'{{!
198         }}>{{#str}}cookiesnotice{{/str}}</button>
199     </div>
200 </div>
202 {{#js}}
203     {{^error}}
204         {{#autofocusform}}
205             var userNameField = document.getElementById('username');
206             if (userNameField.value.length == 0) {
207                 userNameField.focus();
208             } else {
209                 document.getElementById('password').focus();
210             }
211         {{/autofocusform}}
212     {{/error}}
213     {{#error}}
214         document.getElementById('loginerrormessage').focus();
215     {{/error}}
216 {{/js}}