Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Force verification even for refreshed clients #44

Merged
merged 25 commits into from
Oct 3, 2024

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Sep 13, 2024

Followup on #29.

Set a flag on login to remember that the device needs to be verified so that we don't forget if the user refreshes the page, but still allow user with an existing unverified session to stay logged in.

With apologies to the reviewer, this involved changing the flow of what screens are shown when in MatrixChat, which turns out to be somewhat of a jenga tower, so most of the changes here are around getting the tests to pass again, including one to make the post-registration checkboxes not fail if they're displayed before the push rules are fetched. I can split that bit out but it's probably not worth it: the MatrixChat test fixes would be harder.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

Set a flag on login to remember that the device needs to be verified
so that we don't forget if the user refreshes the page, but still allow
user with an existing unverified session to stay logged in.
@dbkr dbkr changed the title Force verification even for refreshed cients Force verification even for refreshed clients Sep 13, 2024
Much, much tweaking to make the matrixchat tests pass again. Should
hopefully make them a bit more solid in general with judicious use of
waitFor rather than flushPromises(). Also lots of fun to stop the state
bleeding between tests.
to hopefully resolve infinite package sadness
Mock out the createClient method to return the same client, because
we've mocked the peg to always return that client, so if we let the
code make another one having still overridden the peg, everything becomes
cursed.

Also mock out the autodiscovery stuff rather than relying on fetch-mock.
Actually it breaks all sorts of other things too, having fixed all the
MatrixChat tests (although this is useful anyway).
but move ready transition to avoid flash of main UI
package.json Show resolved Hide resolved
Comment on lines 149 to 151
if (res.status() / 100 !== 2) {
console.log(await res.json());
}
Copy link
Member

Choose a reason for hiding this comment

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

Remaining logging

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually these were intentional, but I can add a log line so it's more obvious.

playwright/e2e/login/login.spec.ts Outdated Show resolved Hide resolved
playwright/e2e/login/login.spec.ts Outdated Show resolved Hide resolved
src/components/structures/MatrixChat.tsx Outdated Show resolved Hide resolved
src/components/structures/MatrixChat.tsx Show resolved Hide resolved
src/components/structures/MatrixChat.tsx Outdated Show resolved Hide resolved
src/hooks/useUserOnboardingContext.ts Outdated Show resolved Hide resolved
test/components/structures/MatrixChat-test.tsx Outdated Show resolved Hide resolved
@dbkr dbkr added this pull request to the merge queue Oct 3, 2024
Merged via the queue into develop with commit 67cb8b7 Oct 3, 2024
27 checks passed
@dbkr dbkr deleted the dbkr/really_force_verification branch October 3, 2024 09:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants