if @user.persisted?
sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
This method is present in the facebook omniauth callbacks controller
. The problem that I am facing is that I do not get the user's phone number from facebook and thus @user
is not a valid object (I have a validation
). So, I want to redirect the user to another page where I can ask for the phone number.
How can I modify the sign_in_and_redirect @user to redirect me to that page and not the root url.
Sign_in_and_redirect method uses after_sign_in_path_for method to determine where to redirect the user after sign in.
You can easily customize your after_sign_in_path_for method to check for the phone presence and either call super or redirect to the page where user can enter their phone number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With