Implement password nag warning in user settings account section
"To return to your account in future you need to set a password" in the account section when a user has not yet set a password (is a PWLU).
This commit is contained in:
parent
57f01b83be
commit
e16d1b3cfb
1 changed files with 19 additions and 1 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue