简体   繁体   中英

How to redirect default Devise sign_in url to 404 page?

I am trying to make custom sign_in url for my app. So I created a new route in routes.rb . my code sample is

  devise_scope :user do
   get 'site-admin/login', to: 'devise/sessions#new'
  end

But still 'users/sign_in' is also going to login page.How to redirect 'users/sign_in' to 404 page?

According to the devise documentation , all you have to do in your routes.rb is this:

devise_for :users, skip: [:sessions]
as :user do
  get 'site-admin/login', to: 'devise/sessions#new', as: :new_user_session
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.

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