devise_for :admins, path: 'admins'
devise_scope :admin do
root to: "devise/sessions#new"
end
http://localhost:3000/
I want to redirect admins/sign_in path when I just enter above url, login page is opening sometimes but after click on login button every time I get this error and not sign in. How to solve this problem?
error:
Filter chain halted as :require_no_authentication rendered or redirected
look like you're trying to log in the same user again without a sign out
devise_for :admins, path: 'admins'
devise_scope :admin do
authenticated :admin do
root 'home#index', as: :authenticated_root
end
unauthenticated do
root 'devise/sessions#new', as: :unauthenticated_root
end
end
You can achieve the same with this
routes.rb
root "home#index"
devise_for :admins, path: 'admins'
home_controller.rb
class HomeController < ApplicationController
def index
if not admin_signed_in?
redirect_to admin_session_path
end
end
A logged user can't sign in again...
You can try this, in your session_controller.rb add
class Users::SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
end
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.