mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Merge pull request #7255 from Nerdinacan/fix_logout_behavior_7249
Changed logout behavior to automatically redirect home
This commit is contained in:
@@ -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: {
|
||||
@@ -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"),
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user