Merge pull request #1123 from matrix-org/luke/feature-user-settings-password-warning

Implement password nag warning in user settings account section
pull/21833/head
David Baker 2017-06-20 14:02:20 +01:00 committed by GitHub
commit 6de48d628f
2 changed files with 20 additions and 1 deletions

View File

@ -21,6 +21,7 @@ const MatrixClientPeg = require("../../MatrixClientPeg");
const PlatformPeg = require("../../PlatformPeg");
const Modal = require('../../Modal');
const dis = require("../../dispatcher");
import sessionStore from '../../stores/SessionStore';
const q = require('q');
const packageJson = require('../../../package.json');
const UserSettingsStore = require('../../UserSettingsStore');
@ -243,6 +244,12 @@ module.exports = React.createClass({
this.setState({
language: languageHandler.getCurrentLanguage(),
});
this._sessionStore = sessionStore;
this._sessionStoreToken = this._sessionStore.addListener(
this._setStateFromSessionStore,
);
this._setStateFromSessionStore();
},
componentDidMount: function() {
@ -269,6 +276,12 @@ module.exports = React.createClass({
}
},
_setStateFromSessionStore: function() {
this.setState({
userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
});
},
_electronSettings: function(ev, settings) {
this.setState({ electron_settings: settings });
},
@ -1201,7 +1214,12 @@ module.exports = React.createClass({
<h3>{ _t("Account") }</h3>
<div className="mx_UserSettings_section cadcampoHide">
{ this.state.userHasGeneratedPassword ?
<div className="mx_UserSettings_passwordWarning">
<img className="mx_UserSettings_passwordWarning_icon" src="img/warning.svg" width="24" height="23" alt="Warning"/>
{ _t("To return to your account in future you need to set a password") }
</div> : null
}
<AccessibleButton className="mx_UserSettings_logout mx_UserSettings_button" onClick={this.onLogoutClicked}>
{ _t("Sign out") }
</AccessibleButton>

View File

@ -912,6 +912,7 @@
"Disable Peer-to-Peer for 1:1 calls": "Disable Peer-to-Peer for 1:1 calls",
"Do you want to set an email address?": "Do you want to set an email address?",
"This will allow you to reset your password and receive notifications.": "This will allow you to reset your password and receive notifications.",
"To return to your account in future you need to set a password": "To return to your account in future you need to set a password",
"Skip":"Skip",
"Start verification": "Start verification",
"Share without verifying": "Share without verifying",