MDL-50472 auth: Add maintenance message to the login page.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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($) {
|
||||
|
||||
Reference in New Issue
Block a user