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/loginform
20 Moodle template for the login page.
22 Example context (json):
24 "autofocusform": false,
25 "canloginasguest": true,
26 "canloginbyemail": true,
29 "errorformatted": "Test error formatted",
30 "forgotpasswordurl": "http://example.com/login/forgot_password.php",
31 "hasidentityproviders": false,
32 "hasinstructions": true,
33 "instructions": "For full access to this site, you first need to create an account.",
34 "loginurl": "http://example.com/stable_master/login/index.php",
35 "rememberusername": true,
36 "signupurl": "http://localhost/stable_master/login/signup.php",
37 "cookieshelpiconformatted": "",
42 <div class="loginbox clearfix twocolumns">
45 <div class="loginbox clearfix onecolumn">
48 <div class="loginpanel">
50 <div class="skiplinks">
51 <a class="skip" href="{{signupurl}}">{{#str}} tocreatenewaccount {{/str}}</a>
55 <h2>{{#str}} login {{/str}}</h2>
57 <div class="subcontent loginsub">
59 <div class="loginerrors" role="alert">
60 <a href="#" id="loginerrormessage" class="accesshide">{{error}}</a>
64 <form action="{{loginurl}}" method="post" id="login">
65 <div class="loginform">
66 <div class="form-label">
67 <label for="username">
69 {{#str}} username {{/str}}
72 {{#str}} usernameemail {{/str}}
76 <div class="form-input">
77 <input type="text" name="username" id="username" size="15" value="{{username}}">
79 <div class="clearer"><!-- --></div>
80 <div class="form-label">
81 <label for="password">{{#str}} password {{/str}}</label>
83 <div class="form-input">
84 <input type="password" name="password" id="password" size="15" value="">
88 <div class="clearer"><!-- --></div>
90 <div class="rememberpass">
91 <input type="checkbox" name="rememberusername" id="rememberusername" value="1" {{#username}}checked="checked"{{/username}} />
92 <label for="rememberusername">{{#str}} rememberusername, admin {{/str}}</label>
95 <div class="clearer"><!-- --></div>
96 <input id="anchor" type="hidden" name="anchor" value="" />
97 <script>document.getElementById('anchor').value = location.hash;</script>
98 <input type="submit" id="loginbtn" value={{#quote}}{{#str}} login {{/str}}{{/quote}} />
99 <div class="forgetpass">
100 <a href="{{forgotpasswordurl}}">{{#str}} forgotten {{/str}}</a>
105 {{#str}} cookiesenabled {{/str}}
106 {{{cookieshelpiconformatted}}}
112 <div class="subcontent guestsub">
113 <div class="desc">{{#str}} someallowguest {{/str}}</div>
114 <form action="{{loginurl}}" method="post" id="guestlogin">
115 <div class="guestform">
116 <input type="hidden" name="username" value="guest" />
117 <input type="hidden" name="password" value="guest" />
118 <input type="submit" value={{#quote}}{{#str}} loginguest {{/str}}{{/quote}} />
126 <div class="signuppanel">
128 <h2>{{#str}} firsttime {{/str}}</h2>
129 <div class="subcontent">
132 <div class="signupform">
133 <form action="{{signupurl}}" method="get" id="signup">
135 <input type="submit" value={{#quote}}{{#str}} startsignup {{/str}}{{/quote}} />
143 {{#hasidentityproviders}}
144 <div class="subcontent potentialidps">
145 <h6>{{#str}} potentialidps, auth {{/str}}</h6>
146 <div class="potentialidplist">
147 {{#identityproviders}}
148 <div class="potentialidp">
149 <a href="{{url}}" title={{#quote}}{{name}}{{/quote}} class="btn">
151 <img src="{{iconurl}}" alt="" width="24" height="24"/>
156 {{/identityproviders}}
159 {{/hasidentityproviders}}
165 require(['jquery'], function($) {
166 $('#loginerrormessage').focus();
171 require(['jquery'], function($) {
172 if ($('#username').val()) {
173 $('#password').focus();
175 $('#username').focus();