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

Make login more robust against faulty cases #858

Merged
merged 4 commits into from
Mar 30, 2023

Conversation

KitsuneRal
Copy link
Member

Main part of that is pulling the login code back from AccountRegistry into MainWindow.

@KitsuneRal KitsuneRal added bug/fix Quaternion doesn't work as expected enhancement A feature or change request for Quaternion labels Mar 30, 2023
@KitsuneRal KitsuneRal added this to In work in Quaternion 1 via automation Mar 30, 2023
For saved but not logged in accounts, using an initial device name that
is different from the saved one causes the homeserver to generate a new
device, which may be undesirable, especially from the E2EE perspective.
This commit makes LoginDialog to load the initial device name and
the device id for a specified account if that account is saved but not
logged in yet. The device id is now shown in UI (TODO: tuck the device
id and the homeserver behind some "Advanced" button); changing
the initial device name clears the device id (to reflect the homeserver
logic).

To make the login experience even better, two more things would be great
on top: making the user id a combo box so that the user could browse
saved account names; and adding a "Forget" button to completely remove
the saved account from the configuration.
Singletons are increasingly seen as an anti-pattern that introduces
very strong coupling across the codebase. Quotient::Accounts ended up
being a prominent example of such coupling causing difficulties - e.g.,
interfering with clients making their own registries with different
account/connection lifecycle management strategies.

This commit introduces a member in MainWindow that points to Accounts;
all other calls to Accounts are replaced with calls to this member.
All classes that use Accounts for now are actually MainWindow children
and only use Accounts at initialisation; so it's quite easy to pass
the pointer to the registry as one more argument to the respective
constructors.

Eventually, MainWindow will have an AccountRegistry instance of its own
instead of using the library singleton.
AccountRegistry::invokeLogin() is deprecated as it is too opinionated
and tries to do too many things at once (collecting account settings,
creating Connection objects, and validating access tokens, to name
a few). So it is replaced with MainWindow::invokeLogin() (as it used
to be before) that, in turn, delegates the retriying loop to a newly
introduced class, ConnectionInitiator (which might be worth putting
into libQuotient further down the road).
@KitsuneRal KitsuneRal force-pushed the kitsune/make-login-actually-work-again branch from 11ab26b to b07fd1a Compare March 30, 2023 15:51
@KitsuneRal
Copy link
Member Author

There were unrelated commits before the force-push, disregard them.

@KitsuneRal KitsuneRal merged commit 823ed5c into dev Mar 30, 2023
Quaternion 1 automation moved this from In work to Version 0.0.96 - Done Mar 30, 2023
@KitsuneRal KitsuneRal deleted the kitsune/make-login-actually-work-again branch March 30, 2023 16:57
@KitsuneRal KitsuneRal linked an issue Apr 6, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/fix Quaternion doesn't work as expected enhancement A feature or change request for Quaternion
Projects
Status: Version 0.0.96 - Done
Quaternion 1
  
Version 0.0.96 - Done
Development

Successfully merging this pull request may close these issues.

Login duplicates
1 participant