mirror of
https://github.com/moodle/moodle.git
synced 2025-04-26 19:03:38 +02:00
MDL-50472 auth: Add maintenance message to the login page.
This commit is contained in:
parent
f622ee97e3
commit
c5d1c2dcf8
@ -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;
|
||||
}
|
||||
|
@ -38,8 +38,9 @@
|
||||
* cookieshelpiconformatted - Formatted html of cookies help icon,
|
||||
* errorformatted - Formatted error,
|
||||
* logourl - Flag, logo url,
|
||||
* sitename - Name of site.
|
||||
* logintoken - Random token to protect login request.
|
||||
* sitename - Name of site.,
|
||||
* logintoken - Random token to protect login request.,
|
||||
* maintenance - Maintenance message
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
@ -89,7 +90,8 @@
|
||||
"errorformatted": "",
|
||||
"logourl": false,
|
||||
"sitename": "Beer & Chips",
|
||||
"logintoken": "randomstring"
|
||||
"logintoken": "randomstring",
|
||||
"maintenance": "For full access to this site, you need to login in as an admin."
|
||||
}
|
||||
}}
|
||||
|
||||
@ -224,6 +226,22 @@
|
||||
</div>
|
||||
{{/hasinstructions}}
|
||||
|
||||
{{#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($) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user