Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 Rails 应用程序使用 Devise 进行授权,有时尝试登录的用户在数据库上被禁用,并将标志设置为“false”。
有没有办法设计使用这个标志来防止停用的用户登录系统?
您可以像这样将检查deactivated字段添加到active_for_authentication?方法中:
deactivated
active_for_authentication?
def active_for_authentication? super && !deactivated? end