I want to do some extra validation on fields in django-allauth. For example I want to prevent using free email addresses. So I want to run this method on signup
<
There are some adapters on the allauth configuration. For example this one:
ACCOUNT_ADAPTER (="allauth.account.adapter.DefaultAccountAdapter")
Specifies the adapter class to use, allowing you to alter certain default behaviour.
You can specify a new adapter by overriding the default one. Just override the clean_email method.
class MyCoolAdapter(DefaultAccountAdapter):
def clean_email(self, email):
"""
Validates an email value. You can hook into this if you want to
(dynamically) restrict what email addresses can be chosen.
"""
*** here goes your code ***
return email
Then modify the ACCOUNT_ADAPTER on the settings.py
ACCOUNT_ADAPTER = '**app**.MyCoolAdapter'
Check the default behavior on: https://github.com/pennersr/django-allauth/blob/master/allauth/account/adapter.py