Skip to content

Show an error note when login is rejected for an untrusted origin - #67393

Open
wanjinhao1 wants to merge 2 commits into
nextcloud:masterfrom
wanjinhao1:agent/fix-67364-invalid-origin-message
Open

wanjinhao1 wants to merge 2 commits into
nextcloud:masterfrom
wanjinhao1:agent/fix-67364-invalid-origin-message

Conversation

@wanjinhao1

Copy link
Copy Markdown

Summary

LoginController::tryLogin() rejects login requests whose Origin header is not trusted with the invalidOrigin error, but the login form did not handle that error, so the user landed back on the form with no message, as if the login had been silently ignored.

This adds an invalidOrigin note card (warning, like apacheAuthFailed) with a heading and a message telling the user to reload the page and try again, or contact their administrator, and a test case in the existing LoginForm spec covering the new error rendering.

TODO

  • Implementation
  • Test included

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes — the change adds a text-only NcNoteCard in the same style as the existing csrfCheckFailed/apacheAuthFailed notes, no layout change
  • Documentation (manuals or wiki) has been updated or is not required
  • Backports requested where applicable (ex: critical bugfixes) — not applicable, minor UX fix on master
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component) — leaving to maintainers
  • Milestone added for target branch/version (ex: 32.x for stable32) — leaving to maintainers

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Assisted by an AI coding agent; the change was reviewed, tested locally (npx vitest run core/src/tests/components/Login/LoginForm.spec.ts, 11 tests passing) and signed off by the contributor.

… untrusted origin

Signed-off-by: wanjinhao1 <394959433@qq.com>
@wanjinhao1
wanjinhao1 requested a review from a team as a code owner December 1, 2026 18:21
@wanjinhao1
wanjinhao1 requested review from kristian-zendato and skjnldsv and removed request for a team December 1, 2026 18:21
Comment thread core/src/components/login/LoginForm.vue Outdated
v-if="invalidOrigin"
:heading="t('core', 'Untrusted origin')"
type="warning">
{{ t('core', 'The login request did not come from a trusted origin. Please reload the page and try again, or contact your administrator.') }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would reloading the page make any difference ? 🤔
I like the idea though

…sted-origin note

Signed-off-by: wanjinhao1 <394959433@qq.com>
@wanjinhao1

Copy link
Copy Markdown
Author

Good point — it usually wouldn't: the Origin header of a re-submitted form is the same, and only the administrator can change the trusted domains. The reload advice only covers the rare stale/redirected form case, so I dropped it in 09c4bf8: the note now says to try again and contact the administrator if it keeps failing (same style as csrfCheckFailed, which legitimately advises refreshing, and that one stays as is).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login: no error message when the login is rejected because of an untrusted Origin

2 participants