diff --git a/src/Lifecycle.js b/src/Lifecycle.js
index 64d22bd04c..493bbf12aa 100644
--- a/src/Lifecycle.js
+++ b/src/Lifecycle.js
@@ -22,7 +22,6 @@ import Notifier from './Notifier';
import UserActivity from './UserActivity';
import Presence from './Presence';
import dis from './dispatcher';
-import Modal from './Modal';
import DMRoomMap from './utils/DMRoomMap';
/**
@@ -290,35 +289,19 @@ export function logout() {
return;
}
- var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
- Modal.createDialog(QuestionDialog, {
- title: "Warning",
- description:
-
- 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
will be improved,
- but for now be warned.
-
,
- button: "Continue",
- onFinished: (confirmed) => {
- if (confirmed) {
- MatrixClientPeg.get().logout().then(onLoggedOut,
- (err) => {
- // Just throwing an error here is going to be very unhelpful
- // if you're trying to log out because your server's down and
- // you want to log into a different server, so just forget the
- // access token. It's annoying that this will leave the access
- // token still valid, but we should fix this by having access
- // tokens expire (and if you really think you've been compromised,
- // change your password).
- console.log("Failed to call logout API: token will not be invalidated");
- onLoggedOut();
- }
- );
- }
- },
- });
+ return MatrixClientPeg.get().logout().then(onLoggedOut,
+ (err) => {
+ // Just throwing an error here is going to be very unhelpful
+ // if you're trying to log out because your server's down and
+ // you want to log into a different server, so just forget the
+ // access token. It's annoying that this will leave the access
+ // token still valid, but we should fix this by having access
+ // tokens expire (and if you really think you've been compromised,
+ // change your password).
+ console.log("Failed to call logout API: token will not be invalidated");
+ onLoggedOut();
+ }
+ );
}
/**
diff --git a/src/component-index.js b/src/component-index.js
index e83de8739d..99882e784f 100644
--- a/src/component-index.js
+++ b/src/component-index.js
@@ -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);
import views$dialogs$InteractiveAuthDialog from './components/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';
views$dialogs$NeedToRegisterDialog && (module.exports.components['views.dialogs.NeedToRegisterDialog'] = views$dialogs$NeedToRegisterDialog);
import views$dialogs$QuestionDialog from './components/views/dialogs/QuestionDialog';
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 4a1332be8c..0231bc5038 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -228,8 +228,26 @@ module.exports = React.createClass({
},
onLogoutClicked: function(ev) {
- var LogoutPrompt = sdk.getComponent('dialogs.LogoutPrompt');
- this.logoutModal = Modal.createDialog(LogoutPrompt);
+ var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
+ Modal.createDialog(QuestionDialog, {
+ title: "Sign out?",
+ description:
+
+ 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
will be improved,
+ but for now be warned.
+
,
+ button: "Sign out",
+ onFinished: (confirmed) => {
+ if (confirmed) {
+ dis.dispatch({action: 'logout'});
+ if (this.props.onFinished) {
+ this.props.onFinished();
+ }
+ }
+ },
+ });
},
onPasswordChangeError: function(err) {