简体   繁体   中英

rails devise after sign up not allowing access sign_in and sign_up page

I am using rails4 and latest devise. It seems after I signed up an user from devise, I could not access

/users/sign_in and
/users/sign_up 

pages (all pages being redirected to root )

I have to clean up browser cookies to access these two pagae. Is there some setting I can turn this thing off. I was trying to testing I need to access these pages very often.

Once current_user is set via Devise, the RegistrationsController actions of sign_in and sign_up are no longer available – those actions can only be accessed by non-logged in users.

In both the default RegistrationsController and SessionsController , you'll see the following directive:

prepend_before_filter :require_no_authentication, :only => [ :new, :create ]

Basically, this prevents access to the new and create actions of both controllers by users who are already logged in. This makes sense: if a user is already logged in, why would he/she need to sign in or sign up?

If you'd like to override this default behavior, you can try overriding these controllers with the following:

`prepend_before_filter :require_no_authentication`, :only => :none

This declares that no actions should require_no_authentication as a precursor to access to the action in question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM