Lowercase email when signing up
This commit is contained in:
parent
0c9af1a7fa
commit
30ff196203
@ -3,6 +3,7 @@ from allauth.account.models import EmailAddress
|
||||
from .models import Address, User
|
||||
from .tasks import send_account_created_email
|
||||
|
||||
|
||||
def get_or_create_customer(request, form, shipping_address):
|
||||
address, a_created = Address.objects.get_or_create(
|
||||
first_name=shipping_address['first_name'],
|
||||
@ -24,7 +25,7 @@ def get_or_create_customer(request, form, shipping_address):
|
||||
user, u_created = User.objects.get_or_create(
|
||||
email=form.cleaned_data['email'],
|
||||
defaults={
|
||||
'username': form.cleaned_data['email'],
|
||||
'username': form.cleaned_data['email'].lower(),
|
||||
'is_staff': False,
|
||||
'is_active': True,
|
||||
'is_superuser': False,
|
||||
@ -39,7 +40,9 @@ def get_or_create_customer(request, form, shipping_address):
|
||||
user.addresses.add(address)
|
||||
user.save()
|
||||
|
||||
EmailAddress.objects.create(user=user, email=user.email, primary=True, verified=False)
|
||||
EmailAddress.objects.create(
|
||||
user=user, email=user.email, primary=True, verified=False
|
||||
)
|
||||
|
||||
u = {
|
||||
'full_name': user.get_full_name(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user