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

add logout feature #293

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

add logout feature #293

wants to merge 5 commits into from

Conversation

Guocork
Copy link
Contributor

@Guocork Guocork commented Dec 18, 2024

Fixes #277

@Guocork Guocork marked this pull request as draft December 18, 2024 09:33
@Guocork Guocork changed the title add logout icon add logout feature Dec 18, 2024
@Guocork
Copy link
Contributor Author

Guocork commented Dec 24, 2024

Hi, @kevinaboos , I’ve implemented user account logout in my current commit, but I’ve run into a problem. After logging out, the async_main_loop thread is still using the expired token and throws an 'Invalid access token' error, which means the recently logged-out user can't log in again.

2024-12-24T07:58:55.514036Z ERROR matrix_sdk_ui::sync_service: Error while processing encryption in sync service: Something wrong happened in sliding sync: the server returned an error: [401 / M_UNKNOWN_TOKEN] Invalid access token passed.
src/sliding_sync.rs:1503:13 - Received a sync service state update: Error
src/sliding_sync.rs:1505:17 - Restarting sync service due to error.
src/sliding_sync.rs:1503:13 - Received a sync service state update: Running

However, if I restart the program using cargo run, the start_matrix_tokio function restarts the tokio server and the user can log in normally after logout. So, I’ve come up with a few potential solutions:

  1. Cause tokio server run locally, and when the user logs out, the server stays idle and just restarts, waiting for the user to log in again. (This would be the simplest solution, similar to restarting the program.)
  2. Modify the current async_main_loop so that when the user logs out, it blocks certain parts of the thread and goes back to checking the login status.
  3. Restart the async_main_loop thread itself.

I haven’t tested solutions 2 and 3 yet, so I’m not sure if they’ll work. What do you think about these ideas?

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.

Add logout button
1 participant