Merge pull request #646 from matrix-org/matthew/password-reset-warning
Warn users of E2E key loss when changing/resetting passwords or logging out
This commit is contained in:
commit
fc9987a827
5 changed files with 75 additions and 87 deletions
|
@ -79,8 +79,6 @@ import views$dialogs$ErrorDialog from './components/views/dialogs/ErrorDialog';
|
||||||
views$dialogs$ErrorDialog && (module.exports.components['views.dialogs.ErrorDialog'] = views$dialogs$ErrorDialog);
|
views$dialogs$ErrorDialog && (module.exports.components['views.dialogs.ErrorDialog'] = views$dialogs$ErrorDialog);
|
||||||
import views$dialogs$InteractiveAuthDialog from './components/views/dialogs/InteractiveAuthDialog';
|
import views$dialogs$InteractiveAuthDialog from './components/views/dialogs/InteractiveAuthDialog';
|
||||||
views$dialogs$InteractiveAuthDialog && (module.exports.components['views.dialogs.InteractiveAuthDialog'] = views$dialogs$InteractiveAuthDialog);
|
views$dialogs$InteractiveAuthDialog && (module.exports.components['views.dialogs.InteractiveAuthDialog'] = views$dialogs$InteractiveAuthDialog);
|
||||||
import views$dialogs$LogoutPrompt from './components/views/dialogs/LogoutPrompt';
|
|
||||||
views$dialogs$LogoutPrompt && (module.exports.components['views.dialogs.LogoutPrompt'] = views$dialogs$LogoutPrompt);
|
|
||||||
import views$dialogs$NeedToRegisterDialog from './components/views/dialogs/NeedToRegisterDialog';
|
import views$dialogs$NeedToRegisterDialog from './components/views/dialogs/NeedToRegisterDialog';
|
||||||
views$dialogs$NeedToRegisterDialog && (module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog);
|
views$dialogs$NeedToRegisterDialog && (module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog);
|
||||||
import views$dialogs$QuestionDialog from './components/views/dialogs/QuestionDialog';
|
import views$dialogs$QuestionDialog from './components/views/dialogs/QuestionDialog';
|
||||||
|
|
|
@ -229,8 +229,26 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onLogoutClicked: function(ev) {
|
onLogoutClicked: function(ev) {
|
||||||
var LogoutPrompt = sdk.getComponent('dialogs.LogoutPrompt');
|
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
this.logoutModal = Modal.createDialog(LogoutPrompt);
|
Modal.createDialog(QuestionDialog, {
|
||||||
|
title: "Sign out?",
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
For security, logging out will delete any end-to-end encryption keys from this browser,
|
||||||
|
making previous encrypted chat history unreadable if you log back in.
|
||||||
|
In future this <a href="https://github.com/vector-im/riot-web/issues/2108">will be improved</a>,
|
||||||
|
but for now be warned.
|
||||||
|
</div>,
|
||||||
|
button: "Sign out",
|
||||||
|
onFinished: (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
|
dis.dispatch({action: 'logout'});
|
||||||
|
if (this.props.onFinished) {
|
||||||
|
this.props.onFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordChangeError: function(err) {
|
onPasswordChangeError: function(err) {
|
||||||
|
|
|
@ -87,12 +87,28 @@ module.exports = React.createClass({
|
||||||
this.showErrorDialog("New passwords must match each other.");
|
this.showErrorDialog("New passwords must match each other.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
|
Modal.createDialog(QuestionDialog, {
|
||||||
|
title: "Warning",
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
Resetting password will currently reset any end-to-end encryption keys on all devices,
|
||||||
|
making encrypted chat history unreadable.
|
||||||
|
In future this <a href="https://github.com/vector-im/riot-web/issues/2671">may be improved</a>,
|
||||||
|
but for now be warned.
|
||||||
|
</div>,
|
||||||
|
button: "Continue",
|
||||||
|
onFinished: (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
this.submitPasswordReset(
|
this.submitPasswordReset(
|
||||||
this.state.enteredHomeserverUrl, this.state.enteredIdentityServerUrl,
|
this.state.enteredHomeserverUrl, this.state.enteredIdentityServerUrl,
|
||||||
this.state.email, this.state.password
|
this.state.email, this.state.password
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onInputChanged: function(stateKey, ev) {
|
onInputChanged: function(stateKey, ev) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
var React = require('react');
|
|
||||||
var dis = require("../../../dispatcher");
|
|
||||||
|
|
||||||
module.exports = React.createClass({
|
|
||||||
displayName: 'LogoutPrompt',
|
|
||||||
|
|
||||||
propTypes: {
|
|
||||||
onFinished: React.PropTypes.func,
|
|
||||||
},
|
|
||||||
|
|
||||||
logOut: function() {
|
|
||||||
dis.dispatch({action: 'logout'});
|
|
||||||
if (this.props.onFinished) {
|
|
||||||
this.props.onFinished();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
cancelPrompt: function() {
|
|
||||||
if (this.props.onFinished) {
|
|
||||||
this.props.onFinished();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onKeyDown: function(e) {
|
|
||||||
if (e.keyCode === 27) { // escape
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
this.cancelPrompt();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="mx_Dialog_content">
|
|
||||||
Sign out?
|
|
||||||
</div>
|
|
||||||
<div className="mx_Dialog_buttons" onKeyDown={ this.onKeyDown }>
|
|
||||||
<button className="mx_Dialog_primary" autoFocus onClick={this.logOut}>Sign Out</button>
|
|
||||||
<button onClick={this.cancelPrompt}>Cancel</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ limitations under the License.
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
var MatrixClientPeg = require("../../../MatrixClientPeg");
|
||||||
|
var Modal = require("../../../Modal");
|
||||||
var sdk = require("../../../index");
|
var sdk = require("../../../index");
|
||||||
import AccessibleButton from '../elements/AccessibleButton';
|
import AccessibleButton from '../elements/AccessibleButton';
|
||||||
|
|
||||||
|
@ -66,6 +67,19 @@ module.exports = React.createClass({
|
||||||
changePassword: function(old_password, new_password) {
|
changePassword: function(old_password, new_password) {
|
||||||
var cli = MatrixClientPeg.get();
|
var cli = MatrixClientPeg.get();
|
||||||
|
|
||||||
|
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
|
Modal.createDialog(QuestionDialog, {
|
||||||
|
title: "Warning",
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
Changing password will currently reset any end-to-end encryption keys on all devices,
|
||||||
|
making encrypted chat history unreadable.
|
||||||
|
This will be <a href="https://github.com/vector-im/riot-web/issues/2671">improved shortly</a>,
|
||||||
|
but for now be warned.
|
||||||
|
</div>,
|
||||||
|
button: "Continue",
|
||||||
|
onFinished: (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
var authDict = {
|
var authDict = {
|
||||||
type: 'm.login.password',
|
type: 'm.login.password',
|
||||||
user: cli.credentials.userId,
|
user: cli.credentials.userId,
|
||||||
|
@ -86,6 +100,9 @@ module.exports = React.createClass({
|
||||||
phase: self.Phases.Edit
|
phase: self.Phases.Edit
|
||||||
});
|
});
|
||||||
}).done();
|
}).done();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onClickChange: function() {
|
onClickChange: function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue