Esempio n. 1
0
 def clean(self):
     if self.is_guest_checkout() or self.is_new_account_checkout():
         if 'password' in self.errors:
             del self.errors['password']
         if 'username' in self.cleaned_data:
             email = normalize_email(self.cleaned_data['username'])
             if get_user_model().objects.filter(email=email).exists():
                 msg = "A user with that email already exists"
                 self._errors["username"] = self.error_class([msg])
         return self.cleaned_data
     return super(GatewayForm, self).clean()
Esempio n. 2
0
 def clean_username(self):
     return normalize_email(self.cleaned_data['username'])