From 1293b79e382a0e256818c06ad7c1d5a10ff20bb5 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Sun, 17 Aug 2014 13:50:05 -0400 Subject: [PATCH] 3604: Fix theme support for welcome page --- .../app/controllers/application_controller.rb | 8 ++++---- apps/workbench/app/controllers/users_controller.rb | 13 ++++++++++--- apps/workbench/app/views/users/inactive.html.erb | 4 ++++ apps/workbench/config/routes.rb | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index bbc2a825ba..8883e820aa 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -490,7 +490,7 @@ class ApplicationController < ActionController::Base end end - # Reroute this request if an API token is unavailable. + # Redirect to login/welcome if client provided expired API token (or none at all) def require_thread_api_token if Thread.current[:arvados_api_token] yield @@ -501,7 +501,7 @@ class ApplicationController < ActionController::Base session.delete :arvados_api_token redirect_to_login else - render 'users/welcome' + redirect_to welcome_users_path, return_to: request.fullpath end end @@ -515,7 +515,7 @@ class ApplicationController < ActionController::Base def check_user_agreements if current_user && !current_user.is_active if not current_user.is_invited - return render 'users/inactive' + return redirect_to inactive_users_path, return_to: request.fullpath end signatures = UserAgreement.signatures @signed_ua_uuids = UserAgreement.signatures.map &:head_uuid @@ -533,7 +533,7 @@ class ApplicationController < ActionController::Base end end if !current_user.is_active - render 'user_agreements/index' + redirect_to user_agreements_path, return_to: request.fullpath end end true diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb index 67b51a9bc9..1fae7d2872 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -1,11 +1,18 @@ class UsersController < ApplicationController - skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity, :storage] + skip_around_filter :require_thread_api_token, only: :welcome + skip_before_filter :check_user_agreements, only: :inactive + skip_before_filter :find_object_by_uuid, only: [:welcome, :activity, :storage] before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup] def welcome if current_user - params[:action] = 'home' - home + redirect_to (params[:return_to] || '/') + end + end + + def inactive + if current_user.andand.is_invited + redirect_to (params[:return_to] || '/') end end diff --git a/apps/workbench/app/views/users/inactive.html.erb b/apps/workbench/app/views/users/inactive.html.erb index 5f825e47e6..832b580967 100644 --- a/apps/workbench/app/views/users/inactive.html.erb +++ b/apps/workbench/app/views/users/inactive.html.erb @@ -16,6 +16,10 @@ An administrator must activate your account before you can get any further. +

+ + <%= link_to 'Retry', (params[:return_to] || '/'), class: 'btn btn-primary' %> +

diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb index 4ef26612ab..dfd682119c 100644 --- a/apps/workbench/config/routes.rb +++ b/apps/workbench/config/routes.rb @@ -27,6 +27,7 @@ ArvadosWorkbench::Application.routes.draw do get 'choose', :on => :collection get 'home', :on => :member get 'welcome', :on => :collection + get 'inactive', :on => :collection get 'activity', :on => :collection get 'storage', :on => :collection post 'sudo', :on => :member -- 2.30.2