feat: display friendly error messages for LDAP authentication failures#995
Merged
JohnVillalovos merged 1 commit intodevelopfrom Feb 12, 2026
Merged
feat: display friendly error messages for LDAP authentication failures#995JohnVillalovos merged 1 commit intodevelopfrom
JohnVillalovos merged 1 commit intodevelopfrom
Conversation
Wrap authentication validation in try/catch to handle LDAP-related exceptions (missing pear/net_ldap2 library, unreachable LDAP server) and display (hopefully) user-friendly error messages on the login page instead of a generic error or unhandled exception. This doesn't change the message seen if the issue is a wrong username/password.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the login experience by catching LDAP-related authentication exceptions and showing a more specific, user-facing error message on the login page instead of an unhandled exception/generic failure.
Changes:
- Wrap
LoginPresenter::Login()credential validation intry/catchand map known LDAP failure messages to localized UI strings. - Add support in
LoginPage+ template to display an optional login error message override. - Extend fakes/tests to cover exception-driven authentication failures and the new messaging behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
Presenters/LoginPresenter.php |
Catches auth exceptions, logs them, and selects an LDAP-specific message when applicable. |
Pages/LoginPage.php |
Adds SetLoginErrorMessage() and initializes a LoginErrorMessage template variable. |
tpl/login.tpl |
Displays LoginErrorMessage when present, otherwise falls back to the existing LoginError translation. |
tests/fakes/FakeWebAuthentication.php |
Allows the fake Validate() to throw exceptions for presenter tests. |
tests/Presenters/LoginPresenterTest.php |
Adds test cases for LDAP dependency missing / connection errors / generic exception fallback; updates fake page with new setter. |
lang/en_us.php |
Adds new localized strings for LDAP dependency missing and connection errors. |
lang/de_de.php |
Adds the same LDAP error strings in German. |
lang/es.php |
Adds the same LDAP error strings in Spanish. |
lang/ja_jp.php |
Adds the same LDAP error strings in Japanese. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wrap authentication validation in try/catch to handle LDAP-related exceptions (missing pear/net_ldap2 library, unreachable LDAP server) and display (hopefully) user-friendly error messages on the login page instead of a generic error or unhandled exception.
This doesn't change the message seen if the issue is a wrong username/password.