mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 05:29:17 -06:00
DEV: Use shared logout function when revoking all sessions
This commit is contained in:
parent
cab9c7c77e
commit
13a0da8c39
@ -1,4 +1,3 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { not, or, gt } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
@ -11,6 +10,7 @@ import showModal from "discourse/lib/show-modal";
|
||||
import { findAll } from "discourse/models/login-method";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import logout from "discourse/lib/logout";
|
||||
|
||||
// Number of tokens shown by default.
|
||||
const DEFAULT_AUTH_TOKENS_COUNT = 2;
|
||||
@ -240,14 +240,7 @@ export default Controller.extend(CanCheckEmails, PreferencesTabController, {
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
if (!token) {
|
||||
const redirect = this.siteSettings.logout_redirect;
|
||||
if (isEmpty(redirect)) {
|
||||
window.location = Discourse.getURL("/");
|
||||
} else {
|
||||
window.location.href = redirect;
|
||||
}
|
||||
}
|
||||
if (!token) logout(); // All sessions revoked
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user