Session reverification
A signed-in user who can't reverify with their password, such as one whose password showed up in a breach, reverifies the session with a reset password code sent to their verified email address instead. The same step sets a new password. The SDK has no prebuilt view for reverification, so the :e2e host has a small form of its own on the SDK's API.
Sub-features
reset-password-codestarts a first-factor reverification, sends a reset password code to the user's email withSession.sendResetPasswordEmailCode, verifies it withSession.verifyWithResetPasswordEmailCodeand a new password, and then signs in again with the new password.
How to get to it (user POV)
- Sign in and tap
Reverify with a reset codeon the home. The screen hasSend reset code, then the address the code went to, a code field, a new password field, andVerify and set password. A completed reverification returns to the home.
Driving it with verify
Preconditions:
The spec seeds a
+clerk_testuser withhost.seedUser({ password: true })and signs in with a ticket. It declares no settings. The server offersreset_password_email_codein a reverification'ssupported_first_factorsfor every user with a password, unless the instance turns off password reverification, which the standard settings do not.Send the code. Run
e2e-tests/bin/control-clerk-android run session-reverification. The spec tapse2e.home.resetPasswordReverification, thenverify.resetPasswordReverification.sendCode. The form callsSession.startVerificationat the first-factor level, picks thereset_password_email_codefactor, and callsSession.sendResetPasswordEmailCodewith its email address ID. It showsverify.resetPasswordReverification.sentToonly when both returned success. Screenshotreset-code-sent.Verify and set the password. The spec fills
verify.resetPasswordReverification.codewithCLERK_TEST_CODEandverify.resetPasswordReverification.newPasswordwithrunPassword(host.runId), then tapsverify.resetPasswordReverification.verify. The form returns to the home only when the verification's status iscomplete, sohost.expectSignedInAs(user)proves it. Screenshotreverified.Sign in with the new password. The spec signs out, opens
Sign in full screen, fillsclerk.auth.start.identifierwith the user's email, tapsclerk.auth.start.continue, fillsclerk.auth.signIn.passwordwith the new password, and tapsclerk.auth.signIn.continue. The home shows the same user. The run never set that password any other way, so this proves the reverification set it. Screenshotsigned-in-with-new-password.Proof.
specs/features/session-reverification/reset-password-code.e2e.tspasses.
Gotchas
- A reverification error shows in
verify.resetPasswordReverification.error, and the form stays on screen. When the server does not offer the strategy, the error readsReverification does not offer reset_password_email_code. - A status of
needs_second_factoralso shows as an error, because the form has no second-factor step. The standard instance does not require MFA, so the spec does not reach it. - Screenshots blank the password field.