diff --git a/public/auth/tests/behat/loginform.feature b/public/auth/tests/behat/loginform.feature index c5107487ecd..3c7c883c5d4 100644 --- a/public/auth/tests/behat/loginform.feature +++ b/public/auth/tests/behat/loginform.feature @@ -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 diff --git a/public/lib/classes/output/core_renderer.php b/public/lib/classes/output/core_renderer.php index b44d8eba650..b9fe2d771ee 100644 --- a/public/lib/classes/output/core_renderer.php +++ b/public/lib/classes/output/core_renderer.php @@ -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); } diff --git a/public/theme/boost/layout/login.php b/public/theme/boost/layout/login.php index 1a2a0c24d7c..30b9677d642 100644 --- a/public/theme/boost/layout/login.php +++ b/public/theme/boost/layout/login.php @@ -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]), diff --git a/public/theme/boost/templates/core/login_panel.mustache b/public/theme/boost/templates/core/login_panel.mustache index 294ad49b268..e5d969e5d10 100644 --- a/public/theme/boost/templates/core/login_panel.mustache +++ b/public/theme/boost/templates/core/login_panel.mustache @@ -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": "
Your learning journey starts here. Access courses, connect with peers, and achieve your goals.
" + "leftinstructions": "Welcome to our learning platform. Please log in to continue.
" } }}{{#str}}loginpaneltagline{{/str}}
+{{#str}}loginpaneltagline{{/str}}
-