Commits

offline committed f3c9be4

registration validation bugfix in username mode

Comments (0)

Files changed (1)

openauth/forms.py

             if get_object_or_None(User, email=self.cleaned_data['login'].lower()):
                 raise forms.ValidationError(_(u'This email already registered'))
         elif "username" in openauth.settings.AUTHENTICATION_TYPES:
-            if get_object_or_None(User, username=self.cleaned_data['username']):
+            if get_object_or_None(User, username=self.cleaned_data['login']):
                 raise forms.ValidationError(_(u'This login name is already taken'))
         return self.cleaned_data['login']
 
             else:
                 user.username = user.email
         if "username" in openauth.settings.AUTHENTICATION_TYPES:
-            user.username = self.cleaned_data['username']
+            user.username = self.cleaned_data['login']
         user.set_password(self.cleaned_data['password'])
         user.save()
         return user