Log out when account is deactivated

This commit is contained in:
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
// Also we sometimes want to re-log in a guest session
// if we abort the login
_onLoggedOut();
onLoggedOut();
return;
}
return MatrixClientPeg.get().logout().then(_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
@ -60,7 +60,7 @@ function logout() {
// 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();
onLoggedOut();
}
);
}
@ -87,7 +87,7 @@ function startMatrixClient() {
MatrixClientPeg.get().startClient(MatrixClientPeg.opts);
}
function _onLoggedOut() {
function onLoggedOut() {
if (window.localStorage) {
const hsUrl = window.localStorage.getItem("mx_hs_url");
const isUrl = window.localStorage.getItem("mx_is_url");
@ -114,5 +114,5 @@ function _stopMatrixClient() {
}
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,
password: this._passwordField.value,
}).done(() => {
// XXX blocked behind PR
Lifecycle.onLoggedOut();
this.props.onFinished(false);
}, (err) => {
let errStr = 'Unknown error';
// https://matrix.org/jira/browse/SYN-744