You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Log out when account is deactivated
This commit is contained in:
@@ -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
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user