Proyectos de Subversion Moodle

Rev

Rev 750 | Rev 752 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
669 ariadna 1
{{!
2
    This file is part of Moodle - http://moodle.org/
3
 
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.
8
 
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.
13
 
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/>.
16
}}
17
{{!
18
    @template core/loginform
19
 
20
    Moodle template for the login page.
21
 
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
42
 
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=space&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
    }
94
 
95
 
96
}}
97
 
98
<div class="rui-login-layout
99
        {{#loginlayoutimg}}rui-login-layout-img{{/loginlayoutimg}}
100
        {{^loginlayoutimg}}rui-login-layout-simple{{/loginlayoutimg}}
101
        {{#loginlogooutside}}rui-login--logo-outsite{{/loginlogooutside}}
102
        {{#loginlayout1}}rui-login-layout--1{{/loginlayout1}}
103
        {{#loginlayout2}}rui-login-layout--2{{/loginlayout2}}
104
        {{#loginlayout3}}rui-login-layout--3{{/loginlayout3}}
105
        {{#loginlayout4}}rui-login-layout--4{{/loginlayout4}}
106
        {{#loginlayout5}}rui-login-layout--5{{/loginlayout5}}
107
        ">
108
 
109
 
110
    {{#cansignup}}
111
        {{#customsignupoutside}}
112
            <div class="rui-login-top-btn">
113
                <form action="{{signupurl}}" method="get" id="signup">
114
                    {{#stringca}}<span class="rui-login-calabel mr-2">{{{stringca}}}</span>{{/stringca}} <button type="submit" class="btn-link--clean">{{#str}}startsignup{{/str}}</button>
115
                </form>
116
            </div>
117
        {{/customsignupoutside}}
118
    {{/cansignup}}
119
 
120
 
121
    {{#loginlayoutimg}}
122
        <div class="rui-login-wrapper">
123
            <div class="rui-login-top-wrapper">
124
    {{/loginlayoutimg}}
125
 
126
    {{#loginlogooutside}}
127
        <div class="rui-login-logo-container my-6">
128
            {{#loginlayoutimg}}
129
                <div class="rui-login-top">
130
            {{/loginlayoutimg}}
131
            <div>
132
                {{#customloginlogo}}
133
                    <a href="{{{ config.wwwroot }}}" class="text-decoration-none"><img src="{{customloginlogo}}" title="{{sitename}}" alt="{{sitename}}" class="rui-login-logo img-fluid" /></a>
134
                {{/customloginlogo}}
135
 
136
                {{^customloginlogo}}
137
                    {{#logourl}}
138
                        <a href="{{{ config.wwwroot }}}"><img src="{{logourl}}" title="{{sitename}}" alt="{{sitename}}" class="rui-login-logo img-fluid" /></a>
139
                    {{/logourl}}
140
 
141
                    {{^logourl}}
142
                        <a href="{{{ config.wwwroot }}}" class="text-decoration-none">
143
                            <h1 class="rui-login-logo-name">{{sitename}}</h1>
144
                        </a>
145
                    {{/logourl}}
146
                {{/customloginlogo}}
147
            </div>
148
            {{#loginlayoutimg}}
149
        </div>{{/loginlayoutimg}}
150
</div>
151
{{/loginlogooutside}}
152
 
153
{{#loginhtmlcontent1}}
154
    <div class="rui-login-html-1">
155
        {{{loginhtmlcontent1}}}
156
    </div>
157
{{/loginhtmlcontent1}}
158
 
159
{{#loginlayoutimg}}
160
    </div>
161
    </div>
162
{{/loginlayoutimg}}
163
 
164
{{#loginlayoutimg}}
165
    <div class="rui-login-wrapper row no-gutters align-items-center justify-content-center w-100">
166
        <div class="rui-login-container row no-gutters">
167
 
168
{{/loginlayoutimg}}
169
 
170
<div class="rui-login-box">
750 ariadna 171
    <div class="row login-box">
751 ariadna 172
 
673 ariadna 173
        <div class="col col-md-6">
174
            <div class="rui-login-content">
175
                {{#cansignup}}
176
                    <div class="sr-only">
177
                        <a href="{{signupurl}}">{{#str}} tocreatenewaccount {{/str}}</a>
178
                    </div>
179
                {{/cansignup}}
669 ariadna 180
 
673 ariadna 181
                <div class="rui-loginpage-intro">
182
                    {{^loginlogooutside}}
183
                        <div class="rui-loginpage-intro-logo {{#customlogindmlogo}}dark-mode-logo{{/customlogindmlogo}} ">
184
                            {{#customloginlogo}}
185
                                <a href="{{{ config.wwwroot }}}" class="text-decoration-none">
186
                                    <h2><img src="{{customloginlogo}}" title="{{sitename}}" alt="{{sitename}}" class="rui-login-logo img-fluid" /></h2>
187
                                    {{#customlogindmlogo}}<h2><img src="{{customlogindmlogo}}" alt="{{sitename}}" class="rui-custom-dmlogo ml-2 img-fluid" /></h2>{{/customlogindmlogo}}
188
                                </a>
189
                            {{/customloginlogo}}
669 ariadna 190
 
673 ariadna 191
                            {{^customloginlogo}}
192
                                {{#logourl}}
193
                                    <a href="{{{ config.wwwroot }}}" class="text-decoration-none">
194
                                        <h2><img src="{{logourl}}" title="{{sitename}}" alt="{{sitename}}" class="rui-login-logo img-fluid" /></h2>
195
                                    </a>
196
                                {{/logourl}}
669 ariadna 197
 
673 ariadna 198
                                {{^logourl}}
199
                                    <a href="{{{ config.wwwroot }}}" class="text-decoration-none">
200
                                        <h2>{{sitename}}</h2>
201
                                    </a>
202
                                {{/logourl}}
203
                            {{/customloginlogo}}
204
                        </div>
205
                    {{/loginlogooutside}}
206
 
207
                    {{#loginintrotext}}
208
                        <div class="rui-loginpage-intro-content mb-3 text-center">
209
                            {{{loginintrotext}}}
210
                        </div>
211
                    {{/loginintrotext}}
212
 
669 ariadna 213
                </div>
214
 
673 ariadna 215
                {{#error}}
216
                <div class="loginerrors mt-3">
217
                    <a href="#" id="loginerrormessage" class="accesshide">{{error}}</a>
218
                    <div class="alert alert-danger" role="alert" data-aria-autofocus="true">{{error}}</div>
669 ariadna 219
                </div>
673 ariadna 220
                {{/error}}
669 ariadna 221
 
673 ariadna 222
                {{#loginidprovtop}}
223
                    {{#hasidentityproviders}}
224
                        <div class="rui-potentialidplist login-identityproviders mt-3 text-center">
225
                            <p class="small text-center">{{#str}} potentialidps, auth {{/str}}</p>
226
                            <div class="row no-gutters mt-1">
227
                                {{#identityproviders}}
228
                                    <a class="btn btn-secondary login-identityprovider-btn rui-potentialidp w-100 mt-1" href="{{url}}">
229
                                        {{#iconurl}}
230
                                            <img src="{{iconurl}}" alt="" width="24" height="24"/>
231
                                        {{/iconurl}}
232
                                        {{name}}
233
                                    </a>
234
                                {{/identityproviders}}
235
                            </div>
236
                            <hr class="hr-small" />
237
                        </div>
238
                    {{/hasidentityproviders}}
239
                {{/loginidprovtop}}
669 ariadna 240
 
749 ariadna 241
                <div class="rui-login-form">
669 ariadna 242
 
749 ariadna 243
                    <form action="{{loginurl}}" method="post" id="login">
244
                        <input id="anchor" type="hidden" name="anchor" value="">
245
                        <script>
246
                            document.getElementById('anchor').value = location.hash;
247
                        </script>
248
                        <input type="hidden" name="logintoken" value="{{logintoken}}">
249
                        <div class="form-group mb-2 form-control--username-box">
250
                            <label for="username" class="sr-only">
251
                                {{^canloginbyemail}}
252
                                    {{#str}} username {{/str}}
253
                                {{/canloginbyemail}}
254
                                {{#canloginbyemail}}
255
                                    {{#str}} usernameemail {{/str}}
256
                                {{/canloginbyemail}}
257
                            </label>
258
                            <input type="text" name="username" id="username" {{!
259
                        !}}class="form-control form-control--username" {{!
260
                        !}}value="{{username}}" {{!
261
                        !}}placeholder="{{^canloginbyemail}}{{#cleanstr}}username{{/cleanstr}}{{/canloginbyemail}}{{!
262
                        !}}{{#canloginbyemail}}{{#cleanstr}}usernameemail{{/cleanstr}}{{/canloginbyemail}}" {{!
263
                        !}}autocomplete="username">
673 ariadna 264
                        </div>
749 ariadna 265
                        <div class="form-group my-1 form-control--password-box">
266
                            <label for="password" class="sr-only">{{#str}} password {{/str}}</label>
267
                            <input type="password" name="password" id="password" value="" {{!
268
                        !}}class="form-control form-control--password" {{!
269
                        !}}placeholder="{{#cleanstr}}password{{/cleanstr}}" {{!
270
                        !}}autocomplete="current-password">
271
                            <button class="rui-show-password-btn rui-show-password-btn--hidden border-0" id="togglePassword" tabindex="0" type="button" role="button" aria-checked="false">
272
                                <svg class="showpassword-icon--off" width="24" height="24" fill="none" viewBox="0 0 24 24">
273
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 12C19.25 13 17.5 18.25 12 18.25C6.5 18.25 4.75 13 4.75 12C4.75 11 6.5 5.75 12 5.75C17.5 5.75 19.25 11 19.25 12Z"></path>
274
                                    <circle cx="12" cy="12" r="2.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
275
                                </svg>
276
                                <svg class="showpassword-icon--on" width="24" height="24" fill="none" viewBox="0 0 24 24">
277
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M18.6247 10C19.0646 10.8986 19.25 11.6745 19.25 12C19.25 13 17.5 18.25 12 18.25C11.2686 18.25 10.6035 18.1572 10 17.9938M7 16.2686C5.36209 14.6693 4.75 12.5914 4.75 12C4.75 11 6.5 5.75 12 5.75C13.7947 5.75 15.1901 6.30902 16.2558 7.09698"></path>
278
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19.25 4.75L4.75 19.25"></path>
279
                                    <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10.409 13.591C9.53033 12.7123 9.53033 11.2877 10.409 10.409C11.2877 9.5303 12.7123 9.5303 13.591 10.409"></path>
280
                                </svg>
281
                            </button>
673 ariadna 282
                        </div>
749 ariadna 283
                        {{^hideforgotpassword}}
284
                            <div class="w-100 text-center">
285
                                <a class="rui-login-forgot-btn" href="{{forgotpasswordurl}}">{{#str}}forgotten{{/str}}</a>
286
                            </div>
287
                        {{/hideforgotpassword}}
288
                        {{{logininfobox}}}
289
                        {{#recaptcha}}
290
                            <div class="login-form-recaptcha form-group">
291
                                {{{recaptcha}}}
292
                            </div>
293
                        {{/recaptcha}}
294
                        <button type="submit" class="btn btn-lg btn-primary btn-block mt-3" id="loginbtn">{{#str}}login{{/str}}</button>
295
                    </form>
296
                </div>
673 ariadna 297
            <!-- .rui-login-form -->
670 ariadna 298
 
749 ariadna 299
                {{^loginidprovtop}}
300
                    {{#hasidentityproviders}}
301
                        <hr class="hr-small" />
302
                        <div class="rui-potentialidplist login-identityproviders mt-3 text-center">
303
                            <p class="small text-center">{{#str}} potentialidps, auth {{/str}}</p>
304
                            <div class="row no-gutters mt-1">
305
                                {{#identityproviders}}
306
                                    <a class="btn btn-secondary login-identityprovider-btn rui-potentialidp w-100 mt-1" href="{{url}}">
307
                                        {{#iconurl}}
308
                                            <img src="{{iconurl}}" alt="" width="24" height="24"/>
309
                                        {{/iconurl}}
310
                                        {{name}}
311
                                    </a>
312
                                {{/identityproviders}}
313
                            </div>
314
                        </div>
315
                    {{/hasidentityproviders}}
316
                {{/loginidprovtop}}
317
 
318
                <div class="rui-login-additional-btns">
319
                    {{#canloginasguest}}
673 ariadna 320
                    <hr class="hr-small" />
749 ariadna 321
                        <div class="rui-canloginasguest mt-2" title="{{#str}}someallowguest{{/str}}">
322
                            <p class="small text-center">{{#str}}someallowguest{{/str}}</p>
323
                            <form action="{{loginurl}}" method="post" id="guestlogin">
324
                                <input type="hidden" name="logintoken" value="{{logintoken}}">
325
                                <input type="hidden" name="username" value="guest" />
326
                                <input type="hidden" name="password" value="guest" />
327
                                <button class="btn btn-sm btn-outline-secondary w-100" type="submit" id="loginguestbtn">{{#str}}loginguest{{/str}}</button>
328
                            </form>
673 ariadna 329
                        </div>
749 ariadna 330
                    {{/canloginasguest}}
331
                </div><!-- .rui-additional-btns -->
332
 
333
                {{#cansignup}}
334
                    {{^customsignupoutside}}
335
                        <div class="rui-login-createaccount my-4 text-center">
336
                            {{#canloginasguest}}<hr class="hr-small" />{{/canloginasguest}}
337
                            <form action="{{signupurl}}" method="get" id="signup">
338
                                {{#stringca}}
339
                                    <p class="small">{{{stringca}}}</p>
340
                                {{/stringca}}
341
                                <button type="submit" class="btn btn-info w-100">{{#str}}startsignup{{/str}}</button>
342
                            </form>
343
                        </div>
344
                    {{/customsignupoutside}}
345
                {{/cansignup}}
346
 
347
                {{#loginhtmlblockbottom}}
348
                    <div class="rui-login-bottom-block">
349
                        {{{loginhtmlblockbottom}}}
669 ariadna 350
                    </div>
749 ariadna 351
                {{/loginhtmlblockbottom}}
669 ariadna 352
 
749 ariadna 353
                {{#instructions}}
354
                    <div class="rui-hasinstructions-desc alert alert-info">
355
                        {{{instructions}}}
356
                    </div><!-- .rui-hasinstructions-desc -->
357
                {{/instructions}}
669 ariadna 358
 
749 ariadna 359
                {{^loginlayoutimg}}
360
                    {{#loginhtmlcontent3}}
361
                        <div class="rui-login-html-3">
362
                            {{{loginhtmlcontent3}}}
363
                        </div>
364
                    {{/loginhtmlcontent3}}
669 ariadna 365
 
749 ariadna 366
                    {{#loginfootercontent}}
367
                        <div class="rui-login-footer-content text-center mb-2">
368
                            <hr class="hr-small" />
369
                            {{{loginfootercontent}}}
370
                        </div>
371
                    {{/loginfootercontent}}
372
                {{/loginlayoutimg}}
669 ariadna 373
            </div>
673 ariadna 374
        </div>
749 ariadna 375
        <!-- .rui-login-content -->
751 ariadna 376
        <div class="col col-md-6">
377
            <img src="{{{ config.wwwroot }}}/theme/universe_child/pix/login-bg.png"  alt="" width="60" height="60" class="img-fluid login"/>
378
        </div>
673 ariadna 379
    </div>
669 ariadna 380
</div><!-- .rui-login-box -->
381
 
382
 
383
{{#maintenance}}
384
    <div class="rui-maintenance alert alert-warning wrapper-md my-4 p-5">
385
        <h2>{{#str}}sitemaintenance, core_admin{{/str}}</h2>
386
        <div class="rui-maintenance-desc">
387
            {{{maintenance}}}
388
        </div>
389
    </div>
390
{{/maintenance}}
391
 
392
{{#loginlayoutimg}}
393
    <div class="rui-login-bg-container" style="background-image: url('{{loginbg}}');" alt="{{#str}}messagecontentimage, message{{/str}}">
394
        {{#loginhtmlcontent2}}
395
            <div class="rui-login-additional-content">
396
                {{{loginhtmlcontent2}}}
397
            </div>
398
        {{/loginhtmlcontent2}}
399
    </div>
400
{{/loginlayoutimg}}
401
 
402
{{#loginlayoutimg}}
403
    </div>
404
    </div>
405
{{/loginlayoutimg}}
406
 
407
{{#loginlayoutimg}}
408
    <div class="rui-login-wrapper">
409
        {{#loginhtmlcontent3}}
410
            <div class="rui-login-footer rui-login-footer-content">
411
                {{{loginhtmlcontent3}}}
412
            </div>
413
        {{/loginhtmlcontent3}}
414
 
415
        {{#loginfootercontent}}
416
            <div class="rui-login-footer text-center">
417
                {{{loginfootercontent}}}
418
            </div>
419
        {{/loginfootercontent}}
420
 
421
    </div>
422
{{/loginlayoutimg}}
423
 
424
<button type="button" class="btn btn-xs btn-dark btn--cookie" {{!
425
        }} data-modal="alert" {{!
426
        }} data-modal-title-str='["cookiesenabled", "core"]' {{!
427
        }} data-modal-content-str='["cookiesenabled_help_html", "core"]' {{!
428
        }}>
429
    <svg width="20" height="20" fill="none" viewBox="0 0 24 24">
430
        <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 13V15"></path>
431
        <circle cx="12" cy="9" r="1" fill="currentColor"></circle>
432
        <circle cx="12" cy="12" r="7.25" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></circle>
433
    </svg>
434
 
435
    <span class="ml-1">{{#str}}cookiesnotice{{/str}}</span></button>
436
 
437
</div><!-- .login layout -->
438
 
439
{{#js}}
440
    {{^error}}
441
        {{#autofocusform}}
442
            var userNameField = document.getElementById('username');
443
            if (userNameField.value.length == 0) {
444
                userNameField.focus();
445
            } else {
446
                document.getElementById('password').focus();
447
            }
448
        {{/autofocusform}}
449
    {{/error}}
450
    {{#error}}
451
        document.getElementById('loginerrormessage').focus();
452
    {{/error}}
453
    require(['core_form/submit'], function(Submit) {
454
        Submit.init("loginbtn");
455
        {{#canloginasguest}}
456
            Submit.init("loginguestbtn");
457
        {{/canloginasguest}}
458
    });
459
{{/js}}
460
<script>
461
    const togglePassword = document.querySelector("#togglePassword");
462
    const password = document.querySelector("#password");
463
 
464
    togglePassword.addEventListener("click", function() {
465
        // toggle the type attribute
466
        const type = password.getAttribute("type") === "password" ? "text" : "password";
467
        password.setAttribute("type", type);
468
 
469
        // toggle the icon
470
        this.classList.toggle("rui-show-password-btn--hidden");
471
    });
472
</script>
473
 
474
{{{logincustomfooterhtml}}}