Django: How to override authenticate() method?
问题 I use custom User , and I have an email_verified field for this user. I'd like when a user sign in, to be rejected if this field is false . I can't do it in views.py since users can sign in from various sources (Django site but REST APIs too). The whole purpose is to avoid to write N times the logic for N sign in sources. I'd like to override a method ( login() ? authenticate() ?) in models.py to do that only once. I quickly read the doc about customizing authentication but did'nt find what I