mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
FEATURE: log out user everywhere and refresh/redirect
This commit is contained in:
parent
b4844d4477
commit
eb9eada894
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
|
||||
@user.auth_token = nil
|
||||
@user.save!
|
||||
MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
|
@ -535,6 +535,8 @@ en:
|
||||
fixed: "Load Page"
|
||||
close: "Close"
|
||||
assets_changed_confirm: "This site was just updated. Refresh now for the latest version?"
|
||||
logout: "You were logged out."
|
||||
refresh: "Refresh"
|
||||
read_only_mode:
|
||||
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."
|
||||
|
Loading…
Reference in New Issue
Block a user