Example:-
qwe123@pilani.bits-pilani.ac.in
I think i just need to check if the "template ending" is present in the email address or not but the problem is where to check it in the allauth package
Example:-
qwe123@pilani.bits-pilani.ac.in
I think i just need to check if the "template ending" is present in the email address or not but the problem is where to check it in the allauth package
As far as I know, there isn't a direct way to do this in django-allauth. The best bet is to listen for the user_signed_up signal and disable an account that does not have the required email address format.
from allauth.account.signals import user_signed_up
from django.dispatch import receiver
@receiver(user_signed_up)
def after_user_signed_up(request, user):
if user.email.endswith('pilani.bits-pilani.ac.in'):
# do something for valid accounts
else :
user.is_active = False
user.save()
# raise SomeException
If you have more than one address pattern, you will need multiple if statements or possibly create a model for the allowed email address patterns.
There is no direct way to do it. But certainly there are few indirect ways. You can check using email header. From here you can get basic info about the email. You can store ip address
and filter using that for a particular domain.