Repository navigation
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| the IdP (204/401) reports invalid credentials. Login requests now give up | ||
| after 30 seconds without an answer. | ||
|
|
||
| https://github.com/owncloud/ocis/issues/13071 |
There was a problem hiding this comment.
Could you please point to the correct issue? It should be 13072 instead of 13071
dd6d445 to
f49ac15
Compare
jvillafanez
left a comment
There was a problem hiding this comment.
Code looks good to me.
@mzner @LukasHirt do we have any "old browser support" policy? Using the AbortSignal seems a cleaner solution, but it might be too new.
f49ac15 to
391462e
Compare
|
@paul43210 please also rebase because we have updated some tests for improved checking. |
Review feedback on owncloud#13072: the login page's catch block also ran for errors in the page's own code, which would then have read "The server could not be reached". - fetchApi now tags its own rejections with err.kind: "timeout" when the 30 s timer aborted the request, "network" when it never reached the server. - New ErrTimeout message: "The server did not answer in time. Please try again." - ErrFailed is shown only for network failures; any other exception falls through to the generic ErrDefault. - Use optional chaining for result.data, the abort signal and err.kind. TestLoginErrorMessagesAreDistinct also checks that the timeout, failed and default messages differ and that the page branches on the kind; it fails on the previous catch block. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca>
391462e to
01e1b0a
Compare
|
Rebased onto master (d2d82ba) as asked, @mmattel. @LukasHirt's three points are addressed in 01e1b0a (replies inline). @mzner, the changelog link you flagged was fixed earlier (it points to this PR). Could you re-review when you have a moment? |
@paul43210 So sorry for the late reply. Looks good to me. Could you please rebase and push again? |
Review feedback on owncloud#13072: the login page's catch block also ran for errors in the page's own code, which would then have read "The server could not be reached". - fetchApi now tags its own rejections with err.kind: "timeout" when the 30 s timer aborted the request, "network" when it never reached the server. - New ErrTimeout message: "The server did not answer in time. Please try again." - ErrFailed is shown only for network failures; any other exception falls through to the generic ErrDefault. - Use optional chaining for result.data, the abort signal and err.kind. TestLoginErrorMessagesAreDistinct also checks that the timeout, failed and default messages differ and that the page branches on the kind; it fails on the previous catch block. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca>
01e1b0a to
931bb91
Compare
|
The |
The login page used the same text, "Invalid username or password", for ErrInvalid, ErrFailed and ErrDefault, mapped an aborted request to the wrong-credentials message, and had no timeout on the logon request. A user whose request never reached the server (network down, connection blocked by a firewall or a fail2ban ban) was told the password was wrong and kept retrying a correct one. - ErrFailed: "The server could not be reached. Please check your connection and try again." (network errors and timeouts) - ErrDefault: "Something went wrong. Please try again." (server errors) - ErrInvalid is unchanged and is only shown for the IdP's credential rejections (204/401). - Logon and hello requests now abort after 30 s without an answer. - Guard result.data before reading result.data.success. TestLoginErrorMessagesAreDistinct fails on the old code for all four reasons and passes now. Fixes owncloud#13071 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca>
Review feedback on owncloud#13072: the login page's catch block also ran for errors in the page's own code, which would then have read "The server could not be reached". - fetchApi now tags its own rejections with err.kind: "timeout" when the 30 s timer aborted the request, "network" when it never reached the server. - New ErrTimeout message: "The server did not answer in time. Please try again." - ErrFailed is shown only for network failures; any other exception falls through to the generic ErrDefault. - Use optional chaining for result.data, the abort signal and err.kind. TestLoginErrorMessagesAreDistinct also checks that the timeout, failed and default messages differ and that the page branches on the kind; it fails on the previous catch block. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Paul Faure <paul@faure.ca>
931bb91 to
23959df
Compare
|
Rebased onto master (37a8944) as asked, @mmattel; idp tests pass. Head is now 23959df. Thanks @mzner and @LukasHirt for the approvals. |
Description
The built-in IdP login page told users "Invalid username or password" for every failure, including requests that never reached the server. This PR separates the three cases:
success: false): unchanged, "Login failed. Invalid username or password."fetchrejects withTypeError, or the request is aborted): newErrFailedtext, "Login failed. The server could not be reached. Please check your connection and try again."ErrDefaulttext, "Login failed. Something went wrong. Please try again."It also:
AbortController), so a dropped connection ends in a message instead of a form that waits forever;AbortErrorto the wrong-credentials message;result.databefore readingresult.data.success(a 200 with an empty body threw inside the handler).Only the two message strings and the inline login script change; no template or API changes.
Related Issue
Motivation and Context
On a production instance behind Apache with a fail2ban jail that bans an address after repeated failed logins, a banned user's further attempts never reach the server, but the page kept saying the password was wrong, so they kept retrying a correct one. The same happens whenever the network drops or the server is down.
How Has This Been Tested?
c4a6948a67, Go 1.26 (GOTOOLCHAIN=auto), vendored modules.TestLoginErrorMessagesAreDistinct(services/idp/pkg/service/v0) renders the login page and checks thatdata-msg-failedanddata-msg-defaultdiffer fromdata-msg-invalid, that the script usesAbortController, and thatAbortErroris not mapped toMSG_INVALID. It fails on the old code for all four reasons and passes with the fix.go test ./services/idp/...green.node --checkon the extracted login script;make changelog-lintclean.Screenshots (if appropriate):
Types of changes
Checklist:
New strings: the two changed
t.Get(...)messages will need translating through the usual Transifex flow.🤖 Generated with Claude Code
https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT