Skip to content

Commit

Permalink
Merge branch 'MDL-50472' of git://github.com/Chocolate-lightning/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jul 31, 2019
2 parents 1ccc946 + c5d1c2d commit b119595
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
7 changes: 7 additions & 0 deletions auth/classes/output/login.php
Expand Up @@ -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.
Expand Down Expand Up @@ -109,6 +111,10 @@ public function __construct(array $authsequence, $username = '') {
$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();
Expand Down Expand Up @@ -145,6 +151,7 @@ public function export_for_template(renderer_base $output) {
$data->signupurl = $this->signupurl->out(false);
$data->username = $this->username;
$data->logintoken = $this->logintoken;
$data->maintenance = format_text($this->maintenance, FORMAT_MOODLE);

return $data;
}
Expand Down
24 changes: 21 additions & 3 deletions lib/templates/loginform.mustache
Expand Up @@ -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):
{
Expand Down Expand Up @@ -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."
}
}}

Expand Down Expand Up @@ -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($) {
Expand Down

0 comments on commit b119595

Please sign in to comment.