How to make Devise redirect after confirmation

后端 未结 6 814
囚心锁ツ
囚心锁ツ 2020-12-02 13:07

How can I create an after-confirmation redirect in Devise?

Before I added the confirmation module the custom after_sign_up_path worked fine

6条回答
  •  感情败类
    2020-12-02 13:38

    I just went through all of this and none of the other answers worked (2015-04-09 with devise 3.4.1).

    After signup, I wanted the user to be redirected to the login page with a message about a confirmation email. To get that working, here's what I had to do:

    class RegistrationsController < Devise::RegistrationsController
    
    protected
      # This is the method that is needed to control the after_sign_up_path 
      # when using confirmable. 
      def after_inactive_sign_up_path_for(resource)
        new_user_session_path
      end
    
    end
    

    I just found this comment which would have sent me exactly where I needed to be much sooner.

    Here is the reference to the after_inactive_sign_up_path_for that mentions Niels: Devise wiki – marrossa Nov 13 '12 at 3:38

提交回复
热议问题