Add confirmation to skip button

Re-using the opt out phase which was unused
This commit is contained in:
David Baker 2020-01-28 17:15:50 +00:00
parent abfa593791
commit 546acb696d

View file

@ -32,7 +32,7 @@ const PHASE_SHOWKEY = 4;
const PHASE_KEEPITSAFE = 5; const PHASE_KEEPITSAFE = 5;
const PHASE_STORING = 6; const PHASE_STORING = 6;
const PHASE_DONE = 7; const PHASE_DONE = 7;
const PHASE_OPTOUT_CONFIRM = 8; const PHASE_CONFIRM_SKIP = 8;
const PASSWORD_MIN_SCORE = 4; // So secure, many characters, much complex, wow, etc, etc. const PASSWORD_MIN_SCORE = 4; // So secure, many characters, much complex, wow, etc, etc.
const PASSPHRASE_FEEDBACK_DELAY = 500; // How long after keystroke to offer passphrase feedback, ms. const PASSPHRASE_FEEDBACK_DELAY = 500; // How long after keystroke to offer passphrase feedback, ms.
@ -148,11 +148,6 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
this._recoveryKeyNode = n; this._recoveryKeyNode = n;
} }
_onSkipClick = () => {
// TODO: add confirmation
this.props.onFinished(false);
}
_onMigrateFormSubmit = (e) => { _onMigrateFormSubmit = (e) => {
e.preventDefault(); e.preventDefault();
if (this.state.backupSigStatus.usable) { if (this.state.backupSigStatus.usable) {
@ -271,8 +266,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
} }
} }
_onOptOutClick = () => { _onSkipSetupClick = () => {
this.setState({phase: PHASE_OPTOUT_CONFIRM}); this.setState({phase: PHASE_CONFIRM_SKIP});
} }
_onSetUpClick = () => { _onSetUpClick = () => {
@ -496,7 +491,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
disabled={!this._passPhraseIsValid()} disabled={!this._passPhraseIsValid()}
> >
<button type="button" <button type="button"
onClick={this._onCancel} onClick={this._onSkipSetupClick}
className="danger" className="danger"
>{_t("Skip")}</button> >{_t("Skip")}</button>
</DialogButtons> </DialogButtons>
@ -564,7 +559,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
disabled={this.state.passPhrase !== this.state.passPhraseConfirm} disabled={this.state.passPhrase !== this.state.passPhraseConfirm}
> >
<button type="button" <button type="button"
onClick={this._onCancel} onClick={this._onSkipSetupClick}
className="danger" className="danger"
>{_t("Skip")}</button> >{_t("Skip")}</button>
</DialogButtons> </DialogButtons>
@ -669,19 +664,18 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
</div>; </div>;
} }
_renderPhaseOptOutConfirm() { _renderPhaseSkipConfirm() {
const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
return <div> return <div>
{_t( {_t(
"Without setting up secret storage, you won't be able to restore your " + "Without completing security on this device, it wont have " +
"access to encrypted messages or your cross-signing identity for " + "access to encrypted messages.",
"verifying other devices if you log out or use another device.",
)} )}
<DialogButtons primaryButton={_t('Set up secret storage')} <DialogButtons primaryButton={_t('Go back')}
onPrimaryButtonClick={this._onSetUpClick} onPrimaryButtonClick={this._onSetUpClick}
hasCancel={false} hasCancel={false}
> >
<button onClick={this._onCancel}>I understand, continue without</button> <button type="button" className="danger" onClick={this._onCancel}>{_t('Skip')}</button>
</DialogButtons> </DialogButtons>
</div>; </div>;
} }
@ -694,8 +688,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
return _t('Set up encryption'); return _t('Set up encryption');
case PHASE_PASSPHRASE_CONFIRM: case PHASE_PASSPHRASE_CONFIRM:
return _t('Confirm passphrase'); return _t('Confirm passphrase');
case PHASE_OPTOUT_CONFIRM: case PHASE_CONFIRM_SKIP:
return _t('Warning!'); return _t('Are you sure?');
case PHASE_SHOWKEY: case PHASE_SHOWKEY:
return _t('Recovery key'); return _t('Recovery key');
case PHASE_KEEPITSAFE: case PHASE_KEEPITSAFE:
@ -751,8 +745,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent {
case PHASE_DONE: case PHASE_DONE:
content = this._renderPhaseDone(); content = this._renderPhaseDone();
break; break;
case PHASE_OPTOUT_CONFIRM: case PHASE_CONFIRM_SKIP:
content = this._renderPhaseOptOutConfirm(); content = this._renderPhaseSkipConfirm();
break; break;
} }
} }