From bd7784bf8d803ae31f8c722bdbe0181b2f66aff5 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Thu, 30 Aug 2018 16:25:50 +0200 Subject: [PATCH] Redirect home for signed up users to their checks --- app/controllers/application_controller.rb | 12 ++++++++++++ app/controllers/pages_controller.rb | 4 +++- app/views/shared/_navbar.html.erb | 2 +- test/system/users_test.rb | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3fa3d5e..1d70ea6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,6 +15,18 @@ class ApplicationController < ActionController::Base devise_parameter_sanitizer.permit(:account_update, keys: [:notifications_enabled, :locale]) end + def after_sign_in_path_for(_resource) + checks_path + end + + def after_sign_up_path_for(_resource) + checks_path + end + + def after_sign_out_path_for(_resource) + root_path + end + def user_not_authorized flash[:alert] = I18n.t("user_not_authorized", scope: :flashes) redirect_to(request.referrer || root_path) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index d0c1067..8c5d170 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,5 +2,7 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) class PagesController < ApplicationController - def home; end + def home + redirect_to checks_path if user_signed_in? + end end diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 4da000b..f4ba67b 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -2,7 +2,7 @@ <% # License: GNU AGPL-3+ (see full text in LICENSE file) %>