From c9f39e7b1acb05c86b0b958960daefdf6defedc5 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Sun, 27 Aug 2023 16:57:08 +0300 Subject: [PATCH] fix sign up redirect --- app/controllers/registrations_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index d6f4d9b7..84591b2a 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -2,6 +2,7 @@ class RegistrationsController < Devise::RegistrationsController prepend_before_action :require_no_authentication, only: [:show] + prepend_before_action :maybe_redirect_if_signed_in, only: [:show] def show; end @@ -23,6 +24,13 @@ class RegistrationsController < Devise::RegistrationsController super end + def maybe_redirect_if_signed_in + return unless signed_in? + return if params[:redir].blank? + + redirect_to after_sign_up_path_for(current_user) + end + def require_no_authentication super