This commit is contained in:
Huong Nguyen
2026-03-23 09:15:27 +07:00
4 changed files with 41 additions and 25 deletions
@@ -43,11 +43,18 @@ Feature: Test if the login form provides the correct feedback
Then "//img[@id='logoimage' and contains(@src, '/1.jpg')]" "xpath_element" should exist
And "//link[@rel='shortcut icon' and contains(@href, '/2.jpg')]" "xpath_element" should exist
Scenario: Default welcome section is shown when no custom instructions are set
Given I am on homepage
Then I should see "Welcome to Moodle"
And I should see "You're part of a global learning community"
Scenario: Add a custom welcome message
Given the following config values are set as admin:
| auth_instructions | Lorem ipsum dolor sit amet |
And I am on homepage
Then I should see "Lorem ipsum dolor sit amet"
And I should not see "Welcome to Moodle"
And I should not see "You're part of a global learning community"
@javascript @accessibility
Scenario: Show the maintenance mode message
@@ -4668,6 +4668,7 @@ EOD;
true,
['context' => context_course::instance(SITEID), "escape" => false]
);
$context->hasauthinstructions = !empty($CFG->auth_instructions);
return $this->render_from_template('core/loginform', $context);
}
+5 -5
View File
@@ -26,11 +26,11 @@ defined('MOODLE_INTERNAL') || die();
$bodyattributes = $OUTPUT->body_attributes();
// Left-panel instructions.
$leftinstructions = get_string('loginwelcomedescription');
if (!empty($CFG->auth_instructions)) {
$leftinstructions = $CFG->auth_instructions;
}
// Left-panel instructions. Only set when the admin has defined custom instructions;
// the template falls back to the default welcome content when this is empty/null.
$leftinstructions = !empty($CFG->auth_instructions)
? format_text($CFG->auth_instructions, FORMAT_MOODLE, ['context' => context_system::instance()])
: null;
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
@@ -19,31 +19,39 @@
Default content for the left panel of the split-screen login layout.
When leftinstructions is provided (i.e. the site has custom auth instructions configured),
it fully replaces the entire default welcome section (title, tagline, and stats).
Example context (json):
{
"leftinstructions": "<p>Your learning journey starts here. Access courses, connect with peers, and achieve your goals.</p>"
"leftinstructions": "<p>Welcome to our learning platform. Please log in to continue.</p>"
}
}}
<div class="login-layout-left-content">
<h1 class="h2 mb-3">{{#str}}loginwelcometitle{{/str}}</h1>
<div class="mx-auto mb-4 text-start">
{{#leftinstructions}}
{{^leftinstructions}}
<h1 class="h2 mb-3">{{#str}}loginwelcometitle{{/str}}</h1>
<div class="mx-auto mb-4 text-start">
{{#str}}loginwelcomedescription{{/str}}
</div>
<p class="mx-auto mb-4">{{#str}}loginpaneltagline{{/str}}</p>
<div class="login-layout-stats" role="presentation">
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatusers_value{{/str}}</strong>
<span>{{#str}}loginstatusers{{/str}}</span>
</div>
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatsites_value{{/str}}</strong>
<span>{{#str}}loginstatsites{{/str}}</span>
</div>
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatcountries_value{{/str}}</strong>
<span>{{#str}}loginstatcountries{{/str}}</span>
</div>
</div>
{{/leftinstructions}}
{{#leftinstructions}}
<div class="mx-auto text-start">
{{{leftinstructions}}}
{{/leftinstructions}}
</div>
<p class="mx-auto mb-4">{{#str}}loginpaneltagline{{/str}}</p>
<div class="login-layout-stats" role="presentation">
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatusers_value{{/str}}</strong>
<span>{{#str}}loginstatusers{{/str}}</span>
</div>
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatsites_value{{/str}}</strong>
<span>{{#str}}loginstatsites{{/str}}</span>
</div>
<div class="login-layout-stat">
<strong class="login-layout-stat-value">{{#str}}loginstatcountries_value{{/str}}</strong>
<span>{{#str}}loginstatcountries{{/str}}</span>
</div>
</div>
{{/leftinstructions}}
</div>