Merge branch 'MDL-75008-311-enfix' of https://github.com/mudrd8mz/moodle into MOODLE_...
[moodle.git] / auth / shibboleth / templates / login_form.mustache
blobb88e2cb72573c71e5a6b7153581098629b0f028d
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 auth_shibboleth/login_form
20     Template for the Shibboleth authentication plugin's login form.
22     Classes required for JS:
23     * none
25     Data attributes required for JS:
26     * none
28     Context variables required for this template:
29     * adminemail String The Administrator's email address.
30     * cansignup Boolean Whether a new user can sign up for an account.
31     * guestlogin Boolean Whether to show the guest login section.
32     * guestloginurl String The URL for guest login.
33     * idps Array The list of identity providers for the Shibboleth authentication plugin in value-name pairs per IDP.
34     * instructions String Signup instructions.
35     * isvalid Boolean Whether form validation passes.
36     * loginname String The custom login name.
37     * logintoken String The login token.
38     * loginurl String The login URL.
39     * showinstructions Boolean Whether to show additional login instructions.
40     * signupurl String The signup URL.
42     Example context (json):
43     {
44         "loginurl": "#",
45         "guestloginurl": "#",
46         "guestlogin": true,
47         "idps": [
48             { "value": 1, "name": "IDP 1" },
49             { "value": 2, "name": "IDP 2", "selected": true },
50             { "value": 3, "name": "IDP 3" }
51         ],
52         "showinstructions": true,
53         "logintoken": "abcde",
54         "adminemail": "admin@example.com",
55         "loginname": "Shib auth",
56         "cansignup": true,
57         "signupurl": "#",
58         "instructions": "Sign up here",
59         "isvalid": false
60     }
63 <div class="my-1 my-sm-5"></div>
64 <div class="container">
65     <div class="card">
66         <h2 class="card-header">
67             {{#loginname}}{{.}}{{/loginname}}
68             {{^loginname}}{{#str}}auth_shibboleth_login_long, auth_shibboleth{{/str}}{{/loginname}}
69         </h2>
70         <div class="card-body">
71             <div class="row justify-content-center ml-1 mr-1 mb-1">
72                 <div class="col-md-5">
73                     <form action="{{loginurl}}" method="post" id="login">
74                         <div class="form-group">
75                             <label for="idp">{{#str}}auth_shibboleth_select_organization, auth_shibboleth{{/str}}</label>
76                             <select id="idp" name="idp" class="form-control input-block-level {{^isvalid}}is-invalid{{/isvalid}}">
77                                 <option value="-">{{#str}}auth_shibboleth_select_member, auth_shibboleth{{/str}}</option>
78                                 {{#idps}}
79                                     <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
80                                 {{/idps}}
81                             </select>
82                             <div class="invalid-feedback text-danger mb-1" {{#isvalid}}hidden{{/isvalid}}>
83                                 {{#str}}auth_shibboleth_errormsg, auth_shibboleth{{/str}}
84                             </div>
85                         </div>
86                         <button type="submit" class="btn btn-primary btn-block mb-1" accesskey="s">
87                             {{#str}}select, moodle{{/str}}
88                         </button>
89                         <p class="form-text text-muted mt-1 mb-1">
90                             {{#str}}auth_shib_contact_administrator, auth_shibboleth, {{adminemail}}{{/str}}
91                         </p>
92                     </form>
93                 </div>
94                 {{#guestlogin}}
95                 <div class="col-md-5">
96                     <p>
97                         {{#str}}someallowguest, moodle{{/str}}
98                     </p>
99                     <form action="{{guestloginurl}}" method="post" id="guestlogin">
100                         <div class="guestform">
101                             <input type="hidden" name="logintoken" value="{{logintoken}}">
102                             <input type="hidden" name="username" value="guest">
103                             <input type="hidden" name="password" value="guest">
104                             <button type="submit" class="btn btn-secondary btn-block">
105                                 {{#str}}loginguest, moodle{{/str}}
106                             </button>
107                         </div>
108                     </form>
109                 </div>
110                 {{/guestlogin}}
111             </div>
112         </div>
113     </div>
114     {{#showinstructions}}
115     <div class="card mt-1">
116         <div class="card-body ml-1 mr-1 mb-1">
117             <h2 class="card-title">{{#str}}firsttime, moodle{{/str}}</h2>
118             <p>
119                 {{{instructions}}}
120             </p>
121             {{#cansignup}}
122             <form action="{{signupurl}}" method="get" id="signup">
123                 <button type="submit" class="btn btn-secondary">{{#str}}startsignup, moodle{{/str}}</button>
124             </form>
125             {{/cansignup}}
126         </div>
127     </div>
128     {{/showinstructions}}
129 </div>