Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unwanted redirect to IdP from locallogin.php in case alternateloginurl is set, resolves #775 #776

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions locallogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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.
Expand Down
23 changes: 22 additions & 1 deletion tests/behat/theme_boost_union_looksettings_loginpage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down
Loading