MDL-50472 auth: Add maintenance message to the login page.

This commit is contained in:
Mathew May
2019-07-29 10:51:22 +08:00
parent 325b025522
commit 7c5d2ebc95
2 changed files with 25 additions and 1 deletions
+7
View File
@@ -72,6 +72,8 @@ class login implements renderable, templatable {
public $username;
/** @var string The csrf token to limit login to requests that come from the login form. */
public $logintoken;
/** @var string Maintenance message, if Maintenance is enabled. */
public $maintenance;
/**
* Constructor.
@@ -109,6 +111,10 @@ class login implements renderable, templatable {
$this->instructions = get_string('loginsteps', 'core', 'signup.php');
}
if ($CFG->maintenance_enabled == true && !empty($CFG->maintenance_message)) {
$this->maintenance = $CFG->maintenance_message;
}
// Identity providers.
$this->identityproviders = \auth_plugin_base::get_identity_providers($authsequence);
$this->logintoken = \core\session\manager::get_login_token();
@@ -145,6 +151,7 @@ class login implements renderable, templatable {
$data->signupurl = $this->signupurl->out(false);
$data->username = $this->username;
$data->logintoken = $this->logintoken;
$data->maintenance = format_text($this->maintenance, FORMAT_MOODLE);
return $data;
}
+18 -1
View File
@@ -36,7 +36,8 @@
"signupurl": "http://localhost/stable_master/login/signup.php",
"cookieshelpiconformatted": "",
"username": "",
"logintoken": "randomstring"
"logintoken": "randomstring",
"maintenance": "For full access to this site, you need to login in as an admin."
}
}}
{{#hasinstructions}}
@@ -163,6 +164,22 @@
</div>
</div>
{{#maintenance}}
<div class="row justify-content-center mt-3">
<div class="col-xl-6 col-sm-8">
<div class="card">
<div class="card-body">
<div class="card-title">
<h2>{{#str}}sitemaintenance, core_admin{{/str}}</h2>
</div>
<div>
{{{maintenance}}}
</div>
</div>
</div>
</div>
</div>
{{/maintenance}}
{{#js}}
{{#error}}
require(['jquery'], function($) {