Skip to content

Make identity reset consistent with EX #29701

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

andybalaam
Copy link
Member

@andybalaam andybalaam commented Apr 9, 2025

Fixes #29227

This adds IdentityResetDialog, which wraps IdentityResetBody in a dialog, and launches it from SetupEncryptionBody, instead of doing the reset directly there.

This is mostly work by @uhoreg , rebased and refactored a bit here.

I recommend reviewing commit-by-commit.

@andybalaam andybalaam added T-Defect T-Feature Request to add a new feature which does not exist right now and removed T-Defect labels Apr 9, 2025
@andybalaam andybalaam added T-Enhancement and removed T-Feature Request to add a new feature which does not exist right now labels Apr 9, 2025
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 5ca414f to fec5e88 Compare April 11, 2025 10:56
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch 2 times, most recently from 0edccfe to dab78ad Compare April 11, 2025 15:02
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from dab78ad to 8f0073e Compare April 11, 2025 15:12
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 8f0073e to f3035e1 Compare April 14, 2025 09:28
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from f3035e1 to 94c7056 Compare April 14, 2025 14:16
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 94c7056 to 4fdc53e Compare April 14, 2025 14:21
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from 4fdc53e to fff5732 Compare April 14, 2025 16:02
@andybalaam andybalaam force-pushed the andybalaam/reset-encryption-redesign2 branch from fff5732 to eccb05c Compare April 15, 2025 07:31
/**
* Called when the identity is reset (before onFinished is called).
*/
onReset: MouseEventHandler<HTMLButtonElement>;
Copy link
Member

Choose a reason for hiding this comment

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

It seems a bit weird for 'onReset' to take a mouse event: it's hard to see how the original click would be relevant.

},
onFinished: () => {
// The user cancelled the reset dialog or click away - go back a step
this.onResetBackClick();
Copy link
Member

Choose a reason for hiding this comment

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

onFinished is called in either case isn't it? Is there a risk this will confuse things by clicking back after the dialog is done (also I don't love that we are calling click handlers for reasons other than when a click happened).

onReset: () => {
// The user completed the reset process - close this dialog
this.props.onFinished();
this.onDoneClick();
Copy link
Member

Choose a reason for hiding this comment

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

As per below on calling click handlers rather than them just handling clicks.

Comment on lines 45 to 55
// Wrappers for ResetIdentityBody's callbacks so that onFinish gets called
// whenever the reset is done, whether by completing successfully, or by
// being cancelled
const onResetWrapper: MouseEventHandler<HTMLButtonElement> = (...args) => {
onFinished();
onResetFinished(...args);
};
const onCancelWrapper: () => void = () => {
onFinished();
onCancelClick();
};
Copy link
Member

Choose a reason for hiding this comment

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

General feedback: this seems to immediately change in the next commit, so reviewing it is trickier than it needs to be

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Struggling to follow this :/

Comment on lines +78 to -83
} else if (phase === Phase.Busy || phase === Phase.ConfirmReset) {
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
title = _t("encryption|verification|after_new_login|verify_this_device");
} else if (phase === Phase.ConfirmReset) {
icon = <span className="mx_CompleteSecurity_headerIcon mx_E2EIcon_warning" />;
title = _t("encryption|verification|after_new_login|reset_confirmation");
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused about what's going on here. Don't we still need a confirmation step? why do we show "verify this device" (?) when we're in the "ConfirmReset" phase?

* "forgot" is shown when the user has just forgotten their passphrase.
* "forgot" is shown when the user chose 'Forgot recovery key?' during `SetupEncryptionToast`.
*
* "confirm" is shown when the user chose 'Reset all' during `SetupEncryptionBody`.
Copy link
Member

Choose a reason for hiding this comment

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

it would be good to detail how the behaviour is different, rather than when it is called.

Comment on lines -249 to +256
} else if (phase === Phase.ConfirmReset) {
return (
<div>
<p>{_t("encryption|verification|verify_reset_warning_1")}</p>
<p>{_t("encryption|verification|verify_reset_warning_2")}</p>

<div className="mx_CompleteSecurity_actionRow">
<AccessibleButton kind="danger_outline" onClick={this.onResetConfirmClick}>
{_t("encryption|verification|reset_proceed_prompt")}
</AccessibleButton>
<AccessibleButton kind="primary" onClick={this.onResetBackClick}>
{_t("action|go_back")}
</AccessibleButton>
</div>
</div>
);
} else if (phase === Phase.Busy || phase === Phase.Loading) {
} else if (phase === Phase.Busy || phase === Phase.Loading || phase == Phase.ConfirmReset) {
Copy link
Member

Choose a reason for hiding this comment

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

again, bit confused about why it is safe to get rid of the confirm step, and why we now show a spinner for "ConfirmReset".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EW: Make identity reset consistent with EX
3 participants