mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 10:35:31 +08:00
Merge pull request #2979 from techAPJ/patch-1
FEATURE: log out user everywhere and refresh/redirect
This commit is contained in:
commit
d53b4ab5bc
23
app/assets/javascripts/discourse/initializers/logout.js.es6
Normal file
23
app/assets/javascripts/discourse/initializers/logout.js.es6
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
Subscribe to "logout" change events via the Message Bus
|
||||||
|
**/
|
||||||
|
export default {
|
||||||
|
name: "logout",
|
||||||
|
after: "message-bus",
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
|
if (!Discourse.MessageBus) { return; }
|
||||||
|
|
||||||
|
Discourse.MessageBus.subscribe("/logout", function (user_id) {
|
||||||
|
var refresher = function() {
|
||||||
|
var redirect = Discourse.SiteSettings.logout_redirect;
|
||||||
|
if(redirect.length === 0){
|
||||||
|
window.location.pathname = Discourse.getURL('/');
|
||||||
|
} else {
|
||||||
|
window.location.href = redirect;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
bootbox.dialog(I18n.t("logout"), {label: I18n.t("refresh"), callback: refresher}, {onEscape: refresher, backdrop: 'static'})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -68,6 +68,7 @@ class Admin::UsersController < Admin::AdminController
|
|||||||
def log_out
|
def log_out
|
||||||
@user.auth_token = nil
|
@user.auth_token = nil
|
||||||
@user.save!
|
@user.save!
|
||||||
|
MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
|
||||||
render nothing: true
|
render nothing: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -539,6 +539,8 @@ en:
|
|||||||
fixed: "Load Page"
|
fixed: "Load Page"
|
||||||
close: "Close"
|
close: "Close"
|
||||||
assets_changed_confirm: "This site was just updated. Refresh now for the latest version?"
|
assets_changed_confirm: "This site was just updated. Refresh now for the latest version?"
|
||||||
|
logout: "You were logged out."
|
||||||
|
refresh: "Refresh"
|
||||||
read_only_mode:
|
read_only_mode:
|
||||||
enabled: "An administrator enabled read-only mode. You can continue to browse the site but interactions may not work."
|
enabled: "An administrator enabled read-only mode. You can continue to browse the site but interactions may not work."
|
||||||
login_disabled: "Login is disabled while the site is in read only mode."
|
login_disabled: "Login is disabled while the site is in read only mode."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user