且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在允许用户使用设备(导轨)登录之前检查用户是否处于活动状态

更新时间:2023-12-04 09:52:04

将这两个方法添加到您的用户模型中,devise 应该自动选取它们 - 您不需要扩展 Devise::SessionsController

Add these two methods to your user model, devise should pick them up automatically - you should NOT need to extend Devise::SessionsController

def active_for_authentication?
  super && self.your_method_for_checking_active # i.e. super && self.is_active
end

def inactive_message
  "Sorry, this account has been deactivated."
end