I have recently implemented Devise into my new app, in conjunction with Omniauth, however I am unsure how to change the default signin path in Devise so that when I call:
user_authenticated!
It will redirect to the authentication controller page.
Any ideas how to do this?
EDIT: To better explain my problem ->
What I want is when a user tries to access a page that requires you to be logged in and then gets sent to users/sign_in by the user_authenticated before filter, however I want them to be redirected to /auth
via user_authenticated!
not users/sign_in.
In your controller:
before_filter do
authenticate_user! rescue redirect_to auth_url
end
I don't think I really understood your problem, but to redirect to a particular page this should be the implementation
class ApplicationController < ActionController::Base
private
def after_sign_in_path_for(resource_or_scope)
root_path
end
end
if you want to have another url for the sign_in process, in your routes.rb
devise_scope :user do
get "sign_in", :to => "devise/sessions#new"
end
and everything else you need at https://github.com/plataformatec/devise/wiki
hope it's useful
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