diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0e3b50bdf..00bdf3bc4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,8 +5,6 @@ def after_sign_in_path_for(resource) stored_location = stored_location_for(resource) if stored_location stored_location - elsif current_user.admin? || current_user.admin_limited_access? - manage_root_path elsif current_user.questionnaire.nil? new_questionnaires_path else diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 15a762ec3..822d2b20f 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -3,8 +3,4 @@ %h1.section-title.center Sign in to %span.emphasized= HackathonConfig['name'] - - if notice - .form-success - .success_message - %p#notice= notice = render 'form' diff --git a/config/routes.rb b/config/routes.rb index 0cc0da386..eb90c161d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,7 +9,15 @@ mount MailPreview => "mail_view" if Rails.env.development? - root to: "questionnaires#show" + devise_scope :user do + authenticated do + root to: "questionnaires#show" + end + + unauthenticated do + root to: "devise/sessions#new" + end + end authenticate :user, ->(u) { u.admin? } do mount Sidekiq::Web => "/sidekiq" diff --git a/test/integration/user_flows_test.rb b/test/integration/user_flows_test.rb index b7bdb9554..f6131b5cf 100644 --- a/test/integration/user_flows_test.rb +++ b/test/integration/user_flows_test.rb @@ -12,7 +12,7 @@ class UserFlowsTest < ActionDispatch::IntegrationTest should "be able to login and browse site as an admin" do login(FactoryBot.create(:admin)) - assert_redirected_to manage_root_path + assert_redirected_to new_questionnaires_path get manage_dashboard_index_path assert_response :success