I still get a redirect loop after sign in

8 views
Skip to first unread message

marcamillion

unread,
Mar 24, 2015, 11:23:58 PM3/24/15
to plataforma...@googlegroups.com
Even though I followed the guide here - https://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign-in

I still get the redirect loop after the user has signed in.

This is what my routes looks like:

  devise_for :users, :path_names => { :sign_up => "register", 
                                      :sign_in => "login", 
                                      :sign_out => "logout",
  :settings => "settings" },
                    :controllers => { confirmations: "confirmations", 
                                      registrations: "users/registrations", 
                                      passwords: "users/passwords" }

And then I added this to my ApplicationController:

  def after_sign_in_path_for(resource)
    sign_in_url = new_user_session_url
    if request.referer == sign_in_url
      super
    else
      stored_location_for(resource) || request.referer || root_path
    end
  end


And then I added those respective methods to both `Users/RegistrationsController` and `Users/PasswordsController`.

Yet when I sign in, it still tells me there is a redirect loop and throws an error.

Thoughts?
Reply all
Reply to author
Forward
0 new messages