diff --git a/lib/templates/login.mustache b/lib/templates/login.mustache new file mode 100644 index 00000000000..6d6688dee34 --- /dev/null +++ b/lib/templates/login.mustache @@ -0,0 +1,153 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template core/login + + Moodle template for the login page + +}} +
+
+ {{#_signuplink}} + + {{/_signuplink}} +

{{#str}} login {{/str}}

+
+ {{#errormsg}} +
+ {{errormsg}} + {{{errormsg_error_text}}} +
+ {{/errormsg}} +
+
+
+ +
+
+ +
+
+
+ +
+
+ +
+
+ +
+ {{#_rememberusername}} +
+ + +
+ {{/_rememberusername}} +
+ + + + +
+ +
+ {{#str}} cookiesenabled {{/str}} + {{{cookiesenabled_help_icon}}} +
+ +
+ + {{#_guestloginbutton}} +
+
{{#str}} someallowguest {{/str}}
+
+
+ + + +
+
+
+ {{/_guestloginbutton}} + +
+ + {{#_show_instructions}} +
+

{{#str}} firsttime {{/str}}

+
+ {{#_no_auth_enabled}} {{! instructions override the rest for security reasons }} + {{#str}} loginstepsnone {{/str}} + {{/_no_auth_enabled}} + {{^_no_auth_enabled}} + {{#_registerauth_is_email}} + {{#auth_instructions}} + {{{auth_instructions}}} + {{/auth_instructions}} + {{^auth_instructions}} + {{#str}} loginsteps, , 'signup.php' {{/str}} + {{/auth_instructions}} +
+
+
+ +
+
+
+ {{/_registerauth_is_email}} + {{^_registerauth_is_email}} + {{#_registerauth_not_empty}} + {{{auth_instructions}}} +
+
+
+ +
+
+
+ {{/_registerauth_not_empty}} + {{^_registerauth_not_empty}} + {{{auth_instructions}}} + {{/_registerauth_not_empty}} + {{/_registerauth_is_email}} + {{/_no_auth_enabled}} +
+
+ {{/_show_instructions}} + + {{#_potentialidps_not_empty}} +
+
{{#str}} potentialidps, auth {{/str}}
+
+ {{#potentialidps}} +
{{{.}}}
+ {{/potentialidps}} +
+
+ {{/_potentialidps_not_empty}} +
diff --git a/login/index.php b/login/index.php index 5abd4deca11..f4d484cfb12 100644 --- a/login/index.php +++ b/login/index.php @@ -367,7 +367,38 @@ if (isloggedin() and !isguestuser()) { echo $OUTPUT->confirm(get_string('alreadyloggedin', 'error', fullname($USER)), $logout, $continue); echo $OUTPUT->box_end(); } else { - include("index_form.html"); + if ($show_instructions) { + $columns = 'twocolumns'; + } else { + $columns = 'onecolumn'; + } + + // Prepare all objects needed for the login page mustache template. + $data = new stdClass; + $data->columns = $columns; + $data->_signuplink = ($CFG->registerauth == 'email') || !empty($CFG->registerauth); + $data->errormsg = $errormsg; + $data->errormsg_error_text = $OUTPUT->error_text($errormsg); + $data->httpswwwroot = $CFG->httpswwwroot; + $data->_loginpasswordautocomplete_empty = empty($CFG->loginpasswordautocomplete); + $data->_authloginviaemail_empty = empty($CFG->authloginviaemail); + $data->frm_username = p($frm->username); + $data->_rememberusername = (isset($CFG->rememberusername) and $CFG->rememberusername == 2); + $data->cookiesenabled_help_icon = $OUTPUT->help_icon('cookiesenabled'); + $data->_guestloginbutton = $CFG->guestloginbutton and !isguestuser(); + $data->_show_instructions = $show_instructions; + $data->_no_auth_enabled = is_enabled_auth('none'); + $data->_registerauth_is_email = ($CFG->registerauth == 'email'); + $data->_registerauth_not_empty = !empty($CFG->registerauth); + $data->_potentialidps_not_empty = !empty($potentialidps); + $data->potentialidps = $potentialidps; + $data->potentialidps = array(); + foreach($potentialidps as $idp) { + $data->potentialidps[] = html_writer::link($idp['url']->out(), $OUTPUT->render($idp['icon'], $idp['name']) . $idp['name'], array('title' => $idp['name'])); + } + + echo $OUTPUT->render_from_template('core/login', $data); + if ($errormsg) { $PAGE->requires->js_init_call('M.util.focus_login_error', null, true); } else if (!empty($CFG->loginpageautofocus)) { diff --git a/login/index_form.html b/login/index_form.html deleted file mode 100644 index 3b8ae587fe9..00000000000 --- a/login/index_form.html +++ /dev/null @@ -1,124 +0,0 @@ -loginpasswordautocomplete)) { - $autocomplete = 'autocomplete="off"'; -} else { - $autocomplete = ''; -} -if (empty($CFG->authloginviaemail)) { - $strusername = get_string('username'); -} else { - $strusername = get_string('usernameemail'); -} -?> -
-
-registerauth == 'email') || !empty($CFG->registerauth)) { ?> - - -

-
- 'loginerrors')); - echo html_writer::link('#', $errormsg, array('id' => 'loginerrormessage', 'class' => 'accesshide')); - echo $OUTPUT->error_text($errormsg); - echo html_writer::end_tag('div'); - } - ?> -
> -
-
-
- -
-
-
-
- /> -
-
-
- rememberusername) and $CFG->rememberusername == 2) { ?> -
- username) {echo 'checked="checked"';} ?> /> - -
- -
- - - " /> -
-
-
- help_icon('cookiesenabled'); - ?> -
-
- -guestloginbutton and !isguestuser()) { ?> -
-
- -
-
-
- - - " /> -
-
-
- -
- -
-

-
-registerauth == 'email') { - if (!empty($CFG->auth_instructions)) { - echo format_text($CFG->auth_instructions); - } else { - print_string("loginsteps", "", "signup.php"); - } ?> -
-
-
" />
-
-
-registerauth)) { - echo format_text($CFG->auth_instructions); ?> -
-
-
" />
-
-
-auth_instructions); - } ?> -
-
- - - -
- -