Skip to content

Commit

Permalink
Changed logout behavior to automatically redirect home
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerdinacan committed Jan 22, 2019
1 parent c58f9ac commit b123579
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 14 additions & 3 deletions client/galaxy/scripts/layout/menu.js
Expand Up @@ -9,6 +9,18 @@ import { CommunicationServerView } from "layout/communication-server-view";
import Webhooks from "mvc/webhooks";
import Utils from "utils/utils";


function logoutClick() {
let galaxy = getGalaxyInstance();
let token = galaxy.session_csrf_token || "";
if (galaxy.user) {
galaxy.user.clearSessionStorage();
}
let url = `${galaxy.root}user/logout?session_csrf_token=${token}`;
window.top.location.href = url;
}


var Collection = Backbone.Collection.extend({
model: Backbone.Model.extend({
defaults: {
Expand Down Expand Up @@ -290,9 +302,8 @@ var Collection = Backbone.Collection.extend({
},
{
title: _l("Logout"),
url: `user/logout?session_csrf_token=${Galaxy.session_csrf_token}`,
target: "_top",
divider: true
divider: true,
onclick: logoutClick
},
{
title: _l("Saved Datasets"),
Expand Down
7 changes: 2 additions & 5 deletions templates/user/logout.mako
Expand Up @@ -38,11 +38,8 @@ def inherit(context):
<%def name="javascript_app()">
${ parent.javascript_app() }
<script type="text/javascript">
//HACK: should happen before we get to this page - _before_ logged out of session
config.addInitialization(function(galaxy, config) {
if (galaxy.user) {
galaxy.user.clearSessionStorage();
}
config.addInitialization(function(galaxy) {
window.location.href = galaxy.root;
});
</script>
</%def>

0 comments on commit b123579

Please sign in to comment.