Merge branch 'MDL-63442-master' of git://github.com/abias/moodle

This commit is contained in:
Jun Pataleta 2018-10-04 11:02:34 +08:00
commit 86abaf31c8
4 changed files with 20 additions and 4 deletions

View File

@ -85,7 +85,11 @@ class login implements renderable, templatable {
$this->canloginasguest = $CFG->guestloginbutton and !isguestuser();
$this->canloginbyemail = !empty($CFG->authloginviaemail);
$this->cansignup = $CFG->registerauth == 'email' || !empty($CFG->registerauth);
if ($CFG->rememberusername == 0) {
$this->cookieshelpicon = new help_icon('cookiesenabledonlysession', 'core');
} else {
$this->cookieshelpicon = new help_icon('cookiesenabled', 'core');
}
$this->autofocusform = !empty($CFG->loginpageautofocus);
$this->rememberusername = isset($CFG->rememberusername) and $CFG->rememberusername == 2;

View File

@ -276,6 +276,8 @@ $string['cookiesenabled_help'] = 'Two cookies are used by this site:
The essential one is the session cookie, usually called MoodleSession. You must allow this cookie into your browser to provide continuity and maintain your login from page to page. When you log out or close the browser this cookie is destroyed (in your browser and on the server).
The other cookie is purely for convenience, usually called something like MOODLEID. It just remembers your username within the browser. This means when you return to this site the username field on the login page will be already filled out for you. It is safe to refuse this cookie - you will just have to retype your username every time you log in.';
$string['cookiesenabledonlysession'] = 'Cookies must be enabled in your browser';
$string['cookiesenabledonlysession_help'] = 'This site uses one session cookie, usually called MoodleSession. You must allow this cookie into your browser to provide continuity and maintain your login from page to page. When you log out or close the browser this cookie is destroyed (in your browser and on the server).';
$string['cookiesnotenabled'] = 'Unfortunately, cookies are currently not enabled in your browser';
$string['copy'] = 'copy';
$string['copyasnoun'] = 'copy';

View File

@ -4388,10 +4388,16 @@ EOD;
* @return string
*/
public function render_login(\core_auth\output\login $form) {
global $CFG;
$context = $form->export_for_template($this);
// Override because rendering is not supported in template yet.
if ($CFG->rememberusername == 0) {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabledonlysession');
} else {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabled');
}
$context->errorformatted = $this->error_text($context->error);
return $this->render_from_template('core/loginform', $context);

View File

@ -423,12 +423,16 @@ class core_renderer extends \core_renderer {
* @return string
*/
public function render_login(\core_auth\output\login $form) {
global $SITE;
global $CFG, $SITE;
$context = $form->export_for_template($this);
// Override because rendering is not supported in template yet.
if ($CFG->rememberusername == 0) {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabledonlysession');
} else {
$context->cookieshelpiconformatted = $this->help_icon('cookiesenabled');
}
$context->errorformatted = $this->error_text($context->error);
$url = $this->get_logo_url();
if ($url) {