Merge pull request #2979 from techAPJ/patch-1

FEATURE: log out user everywhere and refresh/redirect
This commit is contained in:
Sam 2014-11-21 16:59:44 +11:00
commit d53b4ab5bc
3 changed files with 26 additions and 0 deletions

View 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'})
});
}
};

View File

@ -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

View File

@ -539,6 +539,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."