From f233c0b9cb783cd508f0ebb58ad841dd51e91297 Mon Sep 17 00:00:00 2001 From: Thorsten Siegmund Bartel Date: Wed, 27 Nov 2024 12:37:11 +0100 Subject: [PATCH 1/2] Fix unwanted redirect to IdP from locallogin.php in case alternateloginurl is set. --- locallogin.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/locallogin.php b/locallogin.php index 62716ea36b0..67b1d7da84e 100644 --- a/locallogin.php +++ b/locallogin.php @@ -47,7 +47,8 @@ $config = get_config('theme_boost_union'); // If the local login is not disabled, we just show a short friendly warning page and are done. -if ($config->loginlocalloginenable != THEME_BOOST_UNION_SETTING_SELECT_NO) { +// Also check if alternateloginurl for auth in general is set, so we can provide manual backup. +if ($config->loginlocalloginenable != THEME_BOOST_UNION_SETTING_SELECT_NO && empty($CFG->alternateloginurl)) { echo $OUTPUT->header(); $loginurl = new core\url('/login/index.php'); $notification = new \core\output\notification( @@ -61,8 +62,8 @@ // If the user is already logged in or is a guest user. if (isloggedin() || isguestuser()) { - // We just redirect him to the standard login page to handle this case. - redirect('/login/index.php'); + // We just redirect him to the starting page to handle this case. + redirect('/index.php'); } // Set page title. From 1ede041e43c713a6834940baf9442655e0ad4338 Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Mon, 9 Dec 2024 09:59:56 +0100 Subject: [PATCH 2/2] Review changes --- CHANGES.md | 1 + README.md | 1 + ...boost_union_looksettings_loginpage.feature | 23 ++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 6bc3a321150..3ada411eee0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2024-12-09 - Bugfix: Fix unwanted redirect to IdP from locallogin.php in case alternateloginurl is set, resolves #775. * 2024-12-06 - Tests: Add several Behat optimisations to bring down the test suite run time, resolves #765. * 2024-12-06 - Upstream change: Adopt changes from MDL-83759 ('System notification navbar popover is misplaced in Moodle 4.4 and 4.5') * 2024-12-06 - Upstream change: Adopt changes from MDL-75610 ('Quiz activity name no longer being displayed in quiz landing page when using Safe Exam Browser'), resolves #766. diff --git a/README.md b/README.md index 48da4ff9b0f..6f1e38106fd 100644 --- a/README.md +++ b/README.md @@ -848,6 +848,7 @@ Moodle an Hochschulen e.V. would like to thank these main contributors (in alpha * Moodle.NRW / Ruhr University Bochum, Tim Trappen: Code, Ideating * moodleSCHULE e.V., Ralf Krause: German translation and curation, Ideating * Plakos GmbH, Waldemar Erdmann: Funding, Ideating +* Ruhr University Bochum, Thorsten Bartel: Code * Ruhr University Bochum, Melanie Treitinger: Code, Ideating * RWTH Aachen, Amrita Deb Dutta: Code * RWTH Aachen, Josha Bartsch: Code diff --git a/tests/behat/theme_boost_union_looksettings_loginpage.feature b/tests/behat/theme_boost_union_looksettings_loginpage.feature index 7a33d8220fe..164fcd212d0 100644 --- a/tests/behat/theme_boost_union_looksettings_loginpage.feature +++ b/tests/behat/theme_boost_union_looksettings_loginpage.feature @@ -180,7 +180,7 @@ Feature: Configuring the theme_boost_union plugin for the "Login page" tab on th | yes | should not | should | | no | should | should not | - Scenario: Setting: Local login - Use the side entrance login page + Scenario: Setting: Local login - Use the side entrance login page - Simply login Given the following config values are set as admin: | config | value | plugin | | loginlocalloginenable | no | theme_boost_union | @@ -192,6 +192,27 @@ Feature: Configuring the theme_boost_union plugin for the "Login page" tab on th And I press "Log in" Then I should see "Welcome, Admin" in the "page-header" "region" + Scenario: Setting: Local login - Use the side entrance login page - Visit the side entrace login page again as a already logged in user + Given the following "courses" exist: + | fullname | shortname | + | Course 1 | C1 | + And the following "course enrolments" exist: + | user | course | role | + | admin | C1 | editingteacher | + And the following config values are set as admin: + | config | value | plugin | + | loginlocalloginenable | no | theme_boost_union | + When I am on local login page + And I set the following fields to these values: + # With behat, the password is always the same as the username. + | Username | admin | + | Password | admin | + And I press "Log in" + And I am on "Course 1" course homepage + And I should see "Course 1" in the "#page-header" "css_element" + And I am on local login page + And I should see "Dashboard" in the "#page-header" "css_element" + Scenario Outline: Setting: Local login intro Given the following config values are set as admin: | config | value | plugin |