From 055d6d2e1a03e9b82d0415ea19fd989dcc8b60c0 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Sat, 8 Jun 2013 01:26:46 -0400 Subject: [PATCH] fix redirect/error behavior for session timeouts --- apps/workbench/app/controllers/application_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 92ef77b7c0..81a1075b36 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -153,10 +153,15 @@ class ApplicationController < ActionController::Base if try_redirect_to_login respond_to do |f| f.html { - redirect_to $arvados_api_client.arvados_login_url(return_to: request.url) + if request.method == 'GET' + redirect_to $arvados_api_client.arvados_login_url(return_to: request.url) + else + flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request." + redirect_to :back + end } f.json { - @errors = ['No API token supplied -- can\'t really do anything.'] + @errors = ['You do not seem to be logged in. You did not supply an API token with this request, and your session (if any) has timed out.'] self.render_error status: 422 } end -- 2.30.2