Skip to content

fix(auth): show the sign-in error instead of closing the screen - #18081

Open
filerun wants to merge 1 commit into
nextcloud:masterfrom
filerun:fix/auth-error-message-hidden
Open

filerun wants to merge 1 commit into
nextcloud:masterfrom
filerun:fix/auth-error-message-hidden

Conversation

@filerun

@filerun filerun commented Nov 19, 2026

Copy link
Copy Markdown

Problem

The server can accept the credentials, and the app can still refuse to save the account:

  • An account with the same user and server already exists on the device (ACCOUNT_NOT_NEW).
  • An existing account signs in again, and the server returns another user ID than the one of the account (ACCOUNT_NOT_THE_SAME).

In the standard build, the person sees no message in either case. updateAuthStatus() treats both results as fatal when showWebViewLoginUrl is false. This flag is false in every build that has no branded web login URL. For a fatal result, updateAuthStatus() shows the message in a snackbar and calls finish(). The snackbar belongs to the closing activity, so it disappears at once.

Change

  • initServerUrlLogin() sets showWebViewLoginUrl, because the server address login always shows the address field. The activity stays open, and onCredentialsAccepted() shows the message under the address field.
  • Some builds still close the activity: a branded web login without the address field, the MDM login and the sign-up web view. These builds show the message in a Toast, which stays visible after the activity closes.

This restores the behavior of pull request 5061 of the upstream repository.

How to verify

  1. In the standard build, add an account.
  2. Add the same account again, with the same server and the same user.
  3. Expected: the address form shows "An account for the same user and server already exists on the device" under the address field. Before the change, the form came back, or the screen closed, without a message.

In a branded build with webview_login_url set and show_server_url_input false, the same steps show a Toast with the message, and then the screen closes.

🖼️ Screenshots

No screenshots. The change was not run on a device.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed. The activity has only instrumented tests, and no test was added. The change was not built, and spotless, detekt and lint were not run.
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code, claude-opus-5-5)

🤖 Generated with Claude Code

The server can accept the credentials, and the app can still refuse to save
the account. This happens in two cases:

- An account with the same user and server already exists on the device
  (ACCOUNT_NOT_NEW).
- An existing account signs in again, and the server returns another user ID
  than the one of the account (ACCOUNT_NOT_THE_SAME).

In both cases, onCredentialsAccepted() shows the server address form again,
and puts the message under the address field.

In the standard build, the person never saw that message. updateAuthStatus()
treats both results as fatal when showWebViewLoginUrl is false. This flag is
false in every build that has no branded web login URL. For a fatal result,
updateAuthStatus() shows the message in a snackbar and closes the activity.
The snackbar belongs to the closing activity, so it disappears at once. The
person saw the address form again, or saw the sign-in screen close, without
any explanation.

The activity is meant to close only in a build that has no address field for
the message. Pull request 5061 of the upstream repository introduced this
behavior. It read the flag from show_server_url_input in every build, and it
showed the message in a Toast.

- The server address login now sets showWebViewLoginUrl, because this login
  always shows the address field. The activity stays open and shows the
  message.
- The builds that still close the activity show the message in a Toast. A
  Toast stays visible after the activity closes.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

1 participant