Rails Devise: "You need to log in or register before continuing," rather than "You will receive an email with instructions."

I have a Devise on Rails 4.2.0 setup and everything seems to work, I used the guide at:

http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/

My development modules:

devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable 

The only problem is that if I try to create a new account by going to the registration page, after entering my letter and new password (twice), I will return to the page with the signature and see the message "failed verification"

  You need to sign in or sign up before continuing 

Instead, I should get the message 'send_instructions':

  You will receive an email with instructions for how to confirm your email address in a few minutes. 

I have a pre_filter in my ApplicationController:

 before_filter :authenticate_user!, :except => [:show] 

Although I admit that I do not understand why this does not allow me to authenticate errors on the login page or the "forgotten password" page. In any case, I tried to add: new_user_session to: except, but that didn't help.

How can I get the correct flash notification when someone logs in?

I have not overridden any development code (other than what the source document suggests), my DeviseHelper has only a way to print flash messages:

 def devise_error_messages! return '' if resource.errors.empty? messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join messages.html_safe end 

EDIT:

My initial SO search did not help (there are too many similar questions that were not relevant), but now I found this:

devify sign_in after sign_out error

Therefore, I believe the problem is that Devise is trying to take me to its root_path after the sign_up action has been completed. I do not know why this would do this for: a confirmed setting, it seems that it will return me to the sign_in page.

I tried to override this by overriding 'after_sign_up_path_for' in the cutom registration controller using:

Override Version Registration Controller

Maybe I did it wrong, but it didn't seem to help.

So now the question is: how do I get Devise to return to the sign_in page after someone does sign_up, and why is this not the default action for the confirmation setting?

+6
source share
1 answer

You mentioned the after_sign_up_path_for override in the user registration controller, but by following this link you can try to place this in your application application_controller.rb.

+1
source

Source: https://habr.com/ru/post/985715/


All Articles