What is the best way to ban/block users with Devise for Rails?

前端 未结 3 677
悲&欢浪女
悲&欢浪女 2020-12-24 15:07

I\'m using Devise for authentication in my rails app and I\'d like to be able to block certain accounts and prevent users from reregistering with a blocked email. I\'m just

3条回答
  •  萌比男神i
    2020-12-24 15:58

    A better solution is to override the active_for_authentication? method on the devise model (User). Like so:

        def active_for_authentication?
          super && !self.banned?
        end
    

提交回复
热议问题