Skip to content

Commit

Permalink
MDL-79193 core_auth: Notify about suspended account on login page.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Jan 31, 2025
1 parent 07881a5 commit bb402dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,7 @@
$string['successduration'] = 'Success ({$a} seconds)';
$string['summary'] = 'Summary';
$string['suspended'] = 'Suspended';
$string['suspendedlogin'] = 'Your account has been suspended. Please contact the site administrator.';
$string['suspendedusers'] = 'Suspended users';
$string['switchdevicedefault'] = 'Switch to the standard theme';
$string['switchdevicerecommended'] = 'Switch to the recommended theme for your device';
Expand Down
2 changes: 2 additions & 0 deletions login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@
if (empty($errormsg)) {
if ($errorcode == AUTH_LOGIN_UNAUTHORISED) {
$errormsg = get_string("unauthorisedlogin", "", $frm->username);
} else if ($errorcode == AUTH_LOGIN_SUSPENDED) {
$errormsg = get_string('suspendedlogin');
} else if ($errorcode == AUTH_LOGIN_FAILED_RECAPTCHA) {
$errormsg = get_string('missingrecaptchachallengefield');
} else {
Expand Down
12 changes: 12 additions & 0 deletions login/tests/behat/change_password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,15 @@ Feature: Change password
And I click on "Continue" "button"
And I am on site homepage
And I should see "Course 1"

@javascript
Scenario: A user with a suspended account tries to log in
Given I log in as "admin"
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I press "Suspend user account" action in the "Test User" report row
And I log out
When I follow "Log in"
And I set the field "Username" to "testuser"
And I set the field "Password" to "testuser"
And I press "Log in"
Then I should see "Your account has been suspended. Please contact the site administrator."

0 comments on commit bb402dd

Please sign in to comment.