Change soft logout rehydrate text if there's pending key backups

Fixes https://github.com/vector-im/riot-web/issues/10263
Requires https://github.com/matrix-org/matrix-js-sdk/pull/982
This commit is contained in:
Travis Ralston 2019-07-05 13:52:14 -06:00
parent d39b4e9c7c
commit 55b4ef2169
2 changed files with 17 additions and 1 deletions

View file

@ -64,6 +64,7 @@ export default class SoftLogout extends React.Component {
userId,
displayName,
loginView: LOGIN_VIEW.LOADING,
keyBackupNeeded: true, // assume we do while we figure it out (see componentWillMount)
busy: false,
password: "",
@ -73,6 +74,12 @@ export default class SoftLogout extends React.Component {
this._initLogin();
}
componentWillMount(): void {
MatrixClientPeg.get().flagAllGroupSessionsForBackup().then(remaining => {
this.setState({keyBackupNeeded: remaining > 0});
});
}
onClearAll = () => {
const ConfirmWipeDeviceDialog = sdk.getComponent('dialogs.ConfirmWipeDeviceDialog');
Modal.createTrackedDialog('Clear Data', 'Soft Logout', ConfirmWipeDeviceDialog, {
@ -158,9 +165,16 @@ export default class SoftLogout extends React.Component {
error = <span className='mx_Login_error'>{this.state.errorText}</span>;
}
let introText = _t("Enter your password to sign in and regain access to your account.");
if (this.state.keyBackupNeeded) {
introText = _t(
"Regain access your account and recover encryption keys stored on this device. " +
"Without them, you wont be able to read all of your secure messages on any device.");
}
return (
<form onSubmit={this.onPasswordLogin}>
<p>{_t("Enter your password to sign in and regain access to your account.")}</p>
<p>{introText}</p>
{error}
<Field
id="softlogout_password"