Log out when account is deactivated

pull/21833/head
David Baker 2016-08-03 11:47:29 +01:00
parent f8201ac2ea
commit ffa97a4095
2 changed files with 7 additions and 7 deletions

View File

@ -46,11 +46,11 @@ function logout() {
// logout doesn't work for guest sessions // logout doesn't work for guest sessions
// Also we sometimes want to re-log in a guest session // Also we sometimes want to re-log in a guest session
// if we abort the login // if we abort the login
_onLoggedOut(); onLoggedOut();
return; return;
} }
return MatrixClientPeg.get().logout().then(_onLoggedOut, return MatrixClientPeg.get().logout().then(onLoggedOut,
(err) => { (err) => {
// Just throwing an error here is going to be very unhelpful // Just throwing an error here is going to be very unhelpful
// if you're trying to log out because your server's down and // if you're trying to log out because your server's down and
@ -60,7 +60,7 @@ function logout() {
// tokens expire (and if you really think you've been compromised, // tokens expire (and if you really think you've been compromised,
// change your password). // change your password).
console.log("Failed to call logout API: token will not be invalidated"); console.log("Failed to call logout API: token will not be invalidated");
_onLoggedOut(); onLoggedOut();
} }
); );
} }
@ -87,7 +87,7 @@ function startMatrixClient() {
MatrixClientPeg.get().startClient(MatrixClientPeg.opts); MatrixClientPeg.get().startClient(MatrixClientPeg.opts);
} }
function _onLoggedOut() { function onLoggedOut() {
if (window.localStorage) { if (window.localStorage) {
const hsUrl = window.localStorage.getItem("mx_hs_url"); const hsUrl = window.localStorage.getItem("mx_hs_url");
const isUrl = window.localStorage.getItem("mx_is_url"); const isUrl = window.localStorage.getItem("mx_is_url");
@ -114,5 +114,5 @@ function _stopMatrixClient() {
} }
module.exports = { module.exports = {
setLoggedIn, logout, startMatrixClient setLoggedIn, logout, startMatrixClient, onLoggedOut
}; };

View File

@ -53,8 +53,8 @@ export default class DeactivateAccountDialog extends React.Component {
user: MatrixClientPeg.get().credentials.userId, user: MatrixClientPeg.get().credentials.userId,
password: this._passwordField.value, password: this._passwordField.value,
}).done(() => { }).done(() => {
Lifecycle.onLoggedOut();
// XXX blocked behind PR this.props.onFinished(false);
}, (err) => { }, (err) => {
let errStr = 'Unknown error'; let errStr = 'Unknown error';
// https://matrix.org/jira/browse/SYN-744 // https://matrix.org/jira/browse/SYN-744