How to Remove/Disable Sign Up From Devise

前端 未结 6 1279
余生分开走
余生分开走 2021-02-05 02:56

I\'m trying to remove/disable the user/sign_up path from Devise. I\'m doing this because I don\'t want random people gaining access to the application. I have it p

6条回答
  •  粉色の甜心
    2021-02-05 03:19

    The easiest way is just removing :registerable devise module from the default list defined into your Model (the class name used for the application’s users, usually User).

    class User < ActiveRecord::Base
      devise :database_authenticatable, :registerable,
             :recoverable, :rememberable, :trackable, :validatable
    
      ...
    end
    

    So you'll have it like this:

    class User < ActiveRecord::Base
      devise :database_authenticatable,
             :recoverable, :rememberable, :trackable, :validatable
    
      ...
    end
    

提交回复
热议问题