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/>.
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 * rememberusername - Remeber username?,
37 * signupurl - Signup url,
38 * cookieshelpiconformatted - Formatted html of cookies help icon,
39 * errorformatted - Formatted error,
40 * logourl - Flag, logo url,
41 * sitename - Name of site.
43 Example context (json):
45 "autofocusform": false,
46 "canloginasguest": "1",
47 "canloginbyemail": false,
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>",
60 "value": "Help with Cookies must be enabled in your browser"
64 "value": "Help with Cookies must be enabled in your browser"
68 "value": "http://localhost/stable_master/theme/image.php?theme=boost&component=core&image=help"
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",
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 "rememberusername": true,
86 "signupurl": "http://localhost/stable_master/login/signup.php",
87 "cookieshelpiconformatted": "",
90 "sitename": "Beer & Chips"
94 <div class="m-y-3 hidden-sm-down"></div>
96 <div class="col-xl-6 push-xl-3 m-2-md col-sm-8 push-sm-2">
98 <div class="card-block">
99 <div class="card-title text-xs-center">
101 <h2><img src="{{logourl}}" title="{{sitename}}" alt="{{sitename}}"/></h2>
104 <h2>{{sitename}}</h2>
110 <div class="sr-only">
111 <a href="{{signupurl}}">{{#str}} tocreatenewaccount {{/str}}</a>
116 <div class="loginerrors m-t-1">
117 <a href="#" id="loginerrormessage" class="accesshide">{{error}}</a>
118 <div class="alert alert-danger" role="alert">{{error}}</div>
123 <div class="col-md-4 push-md-1">
124 <form class="m-t-1" action="{{loginurl}}" method="post" id="login">
125 <input id="anchor" type="hidden" name="anchor" value="">
126 <script>document.getElementById('anchor').value = location.hash;</script>
128 <label for="username" class="sr-only">
130 {{#str}} username {{/str}}
133 {{#str}} usernameemail {{/str}}
136 <input type="text" name="username" id="username"
139 placeholder={{#quote}}{{^canloginbyemail}}{{#str}}username{{/str}}{{/canloginbyemail}}{{#canloginbyemail}}{{#str}}usernameemail{{/str}}{{/canloginbyemail}}{{/quote}}>
140 <label for="password" class="sr-only">{{#str}} password {{/str}}</label>
141 <input type="password" name="password" id="password" value=""
143 placeholder={{#quote}}{{#str}}password{{/str}}{{/quote}}>
145 {{#rememberusername}}
146 <div class="rememberpass m-t-1">
147 <input type="checkbox" name="rememberusername" id="rememberusername" value="1" {{#username}}checked="checked"{{/username}} />
148 <label for="rememberusername">{{#str}} rememberusername, admin {{/str}}</label>
150 {{/rememberusername}}
152 <button type="submit" class="btn btn-primary btn-block m-t-1" id="loginbtn">{{#str}}login{{/str}}</button>
156 <div class="col-md-4 push-md-3">
157 <div class="forgetpass m-t-1">
158 <p><a href="{{forgotpasswordurl}}">{{#str}}forgotten{{/str}}</a></p>
162 {{#str}} cookiesenabled {{/str}}
163 {{{cookieshelpiconformatted}}}
167 <p>{{#str}}someallowguest{{/str}}</p>
168 <form action="{{loginurl}}" method="post" id="guestlogin">
169 <input type="hidden" name="username" value="guest" />
170 <input type="hidden" name="password" value="guest" />
171 <button class="btn btn-secondary btn-block" type="submit">{{#str}}loginguest{{/str}}</button>
176 {{#hasidentityproviders}}
177 <h6 class="m-t-2">{{#str}} potentialidps, auth {{/str}}</h6>
178 <div class="potentialidplist" class="m-t-1">
179 {{#identityproviders}}
180 <div class="potentialidp">
181 <a href="{{url}}" title={{#quote}}{{name}}{{/quote}} class="btn btn-secondary btn-block">
183 <img src="{{iconurl}}" alt="" width="24" height="24"/>
188 {{/identityproviders}}
190 {{/hasidentityproviders}}
201 <div class="col-xl-6 push-xl-3 m-2-md col-sm-8 push-sm-2">
203 <div class="card-block">
204 <div class="card-title">
205 <h2>{{#str}}firsttime{{/str}}</h2>
210 <form class="m-t-1" action="{{signupurl}}" method="get" id="signup">
211 <button type="submit" class="btn btn-secondary">{{#str}}startsignup{{/str}}</button>
223 require(['jquery'], function($) {
224 $('#loginerrormessage').focus();
229 require(['jquery'], function($) {
230 if ($('#username').val()) {
231 $('#password').focus();
233 $('#username').focus();