Prompt for recovery key on login rather than passphrase

Only show passphrase options at all if the user has a passphrase on
their SSSS key.
This commit is contained in:
David Baker 2020-06-02 16:32:15 +01:00
parent 631184c661
commit e06ba2003b
9 changed files with 224 additions and 20 deletions

View file

@ -94,7 +94,7 @@ export default class RestoreKeyBackupDialog extends React.PureComponent {
if (SettingsStore.getValue("feature_cross_signing")) {
// If cross-signing is enabled, we reset the SSSS recovery passphrase (and cross-signing keys)
this.props.onFinished(false);
accessSecretStorage(() => {}, /* forceReset = */ true);
accessSecretStorage(() => {}, {forceReset: true});
} else {
Modal.createTrackedDialogAsync('Key Backup', 'Key Backup',
import('../../../../async-components/views/dialogs/keybackup/CreateKeyBackupDialog'),

View file

@ -32,6 +32,9 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
keyInfo: PropTypes.object.isRequired,
// Function from one of { passphrase, recoveryKey } -> boolean
checkPrivateKey: PropTypes.func.isRequired,
// If true, only prompt for a passphrase and do not offer to restore with
// a recovery key or reset keys.
passphraseOnly: PropTypes.bool,
}
constructor(props) {
@ -58,7 +61,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
_onResetRecoveryClick = () => {
// Re-enter the access flow, but resetting storage this time around.
this.props.onFinished(false);
accessSecretStorage(() => {}, /* forceReset = */ true);
accessSecretStorage(() => {}, {forceReset: true});
}
_onRecoveryKeyChange = (e) => {
@ -164,7 +167,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
primaryDisabled={this.state.passPhrase.length === 0}
/>
</form>
{_t(
{this.props.passphraseOnly ? null : _t(
"If you've forgotten your recovery passphrase you can "+
"<button1>use your recovery key</button1> or " +
"<button2>set up new recovery options</button2>."
@ -234,7 +237,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
primaryDisabled={!this.state.recoveryKeyValid}
/>
</form>
{_t(
{this.props.passphraseOnly ? null : _t(
"If you've forgotten your recovery key you can "+
"<button>set up new recovery options</button>."
, {}, {

View file

@ -113,7 +113,7 @@ export default class CrossSigningPanel extends React.PureComponent {
_bootstrapSecureSecretStorage = async (forceReset=false) => {
this.setState({ error: null });
try {
await accessSecretStorage(() => undefined, forceReset);
await accessSecretStorage(() => undefined, {forceReset});
} catch (e) {
this.setState({ error: e });
console.error("Error bootstrapping secret storage", e);