Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Change soft logout rehydrate text if there's pending key backups
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Jul 5, 2019
1 parent d39b4e9 commit 55b4ef2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/structures/auth/SoftLogout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
Expand All @@ -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, {
Expand Down Expand Up @@ -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 won’t 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"
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1586,8 +1586,10 @@
"You can now close this window or <a>log in</a> to your new account.": "You can now close this window or <a>log in</a> to your new account.",
"Registration Successful": "Registration Successful",
"Create your account": "Create your account",
"Failed to re-authenticate due to a homeserver problem": "Failed to re-authenticate due to a homeserver problem",
"Failed to re-authenticate": "Failed to re-authenticate",
"Enter your password to sign in and regain access to your account.": "Enter your password to sign in and regain access to your account.",
"Regain access your account and recover encryption keys stored on this device. Without them, you won’t be able to read all of your secure messages on any device.": "Regain access your account and recover encryption keys stored on this device. Without them, you won’t be able to read all of your secure messages on any device.",
"Forgotten your password?": "Forgotten your password?",
"Cannot re-authenticate with your account. Please contact your homeserver admin for more information.": "Cannot re-authenticate with your account. Please contact your homeserver admin for more information.",
"You're signed out": "You're signed out",
Expand Down

0 comments on commit 55b4ef2

Please sign in to comment.