Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When MFA login fails, display an orange banner at the top of the screen #10645

Closed
laurent22 opened this issue Jun 20, 2024 · 5 comments
Closed
Assignees
Labels
bug It's a bug desktop All desktop platforms high High priority issues mobile All mobile platforms v3.0

Comments

@laurent22
Copy link
Owner

Operating system

Windows

Joplin version

3.0.0

Desktop version info

No response

Current behaviour

Currently when enabling MFA, the next sync operation is going to fail and it will just show this in the sidebar:

image

It's easy to miss it, so instead we should display a banner at the top (using renderNotificationMessage()) telling the user that they need to login. Clicking on the banner should open the Joplin Cloud screen for login (just like when we click on the Synchronize button)

The same should apply to mobile

Expected behaviour

No response

Logs

No response

@laurent22 laurent22 added bug It's a bug mobile All mobile platforms desktop All desktop platforms high High priority issues labels Jun 20, 2024
@laurent22 laurent22 added the v3.0 label Jun 20, 2024
@pedr
Copy link
Collaborator

pedr commented Jun 21, 2024

I'm making a change that might be bigger than the issue seems to ask, but the issue is that when I was checking the implementation I realized that there are many places where the connection to Joplin Cloud can fail.

THe current implementation of isAuthenticated while is useful to check if the user has any credentials, it will return the wrong response if the credentials are invalid (mfa was enabled, or the application record was deleted on the website). This happened because the check to see if the user was authenticated was just seeing if a sessionId existed.

The problem was that while 'isAuthenticatedwould return true, we could see a error happen in the Synchronizer or inside of a call toconfig-shared.checkSyncConfig`, meaning it was harder to be sure if the user was logged in or not.

My solution to fix this was to add a checkConfig inside the SyncTargetJoplinCloud.isAuthenticated, if we get a negative response I already redirect the user to JoplinCloudLoginScreen, avoiding the necessity of adding a banner to inform the user or keeping track of another state in the application.

There is one drawback: it will be harder for the user to see the error message returned by the server since it will only be present inside the log on console/generated by Logger

@pedr
Copy link
Collaborator

pedr commented Jun 21, 2024

I'm adding videos of how the implementation I did work:

First login (application without any state):

first_login.mp4

User was logged in, but credentials turned invalid (mfa was enabled or application was deleted on website):

credential_invalid.mp4

When Joplin Cloud is offline:

joplin_cloud_offline.mp4

@laurent22
Copy link
Owner Author

Thanks for clarifying the situation, but regarding this:

My solution to fix this was to add a checkConfig inside the SyncTargetJoplinCloud.isAuthenticated, if we get a negative response I already redirect the user to JoplinCloudLoginScreen, avoiding the necessity of adding a banner to inform the user or keeping track of another state in the application.

The problem is that synchronisation might fail in the background, so in that case we don't want to jump to the login screen without asking the user.

@pedr
Copy link
Collaborator

pedr commented Jun 21, 2024

The problem is that synchronisation might fail in the background, so in that case we don't want to jump to the login screen without asking the user.

I don't think this will be a problem, I'm not going to change anything about synchronisation, I'm just making isAuthenticated more robust. I'm going to open a PR.

@pedr
Copy link
Collaborator

pedr commented Jun 21, 2024

PR: #10649

laurent22 pushed a commit that referenced this issue Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues mobile All mobile platforms v3.0
Projects
None yet
Development

No branches or pull requests

2 participants