]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/forms/auth.py
Fixed twitter login
[osqa.git] / forum / forms / auth.py
index 594e59f8e526de85326df6fe14d2a2a4a6b88b37..0d07ce81ad8d2d7ea4f896a6338822d85cc7d0d4 100644 (file)
@@ -1,4 +1,4 @@
-from general import NextUrlField,  UserNameField,  UserEmailField, SetPasswordForm
+from general import NextUrlField,  UserNameField,  UserEmailField, UserRealNameField, SetPasswordForm
 from forum.models import Question, User
 from django.contrib.contenttypes.models import ContentType
 from django.utils.translation import ugettext as _
 from forum.models import Question, User
 from django.contrib.contenttypes.models import ContentType
 from django.utils.translation import ugettext as _
@@ -10,6 +10,7 @@ class SimpleRegistrationForm(forms.Form):
     next = NextUrlField()
     username = UserNameField()
     email = UserEmailField()
     next = NextUrlField()
     username = UserNameField()
     email = UserEmailField()
+    real_name = UserRealNameField()
 
 class TemporaryLoginRequestForm(forms.Form):
     def __init__(self, data=None):
 
 class TemporaryLoginRequestForm(forms.Form):
     def __init__(self, data=None):
@@ -26,25 +27,14 @@ class TemporaryLoginRequestForm(forms.Form):
     )
 
     def clean_email(self):
     )
 
     def clean_email(self):
-        try:
-            user = User.objects.get(email=self.cleaned_data['email'])
-        except:
+        users = list(User.objects.filter(email=self.cleaned_data['email']))
+
+        if not len(users):
             raise forms.ValidationError(_("Sorry, but this email is not on our database."))
 
             raise forms.ValidationError(_("Sorry, but this email is not on our database."))
 
-        self.user_cache = user
+        self.user_cache = users
         return self.cleaned_data['email']
 
         return self.cleaned_data['email']
 
-
-class SimpleEmailSubscribeForm(forms.Form):
-    SIMPLE_SUBSCRIBE_CHOICES = (
-        ('y',_('okay, let\'s try!')),
-        ('n',_('no OSQA community email please, thanks'))
-    )
-    subscribe = forms.ChoiceField(widget=forms.widgets.RadioSelect(), \
-                                error_messages={'required':_('please choose one of the options above')},
-                                choices=SIMPLE_SUBSCRIBE_CHOICES)
-
-
 class ChangePasswordForm(SetPasswordForm):
     """ change password form """
     oldpw = forms.CharField(widget=forms.PasswordInput(attrs={'class':'required'}),
 class ChangePasswordForm(SetPasswordForm):
     """ change password form """
     oldpw = forms.CharField(widget=forms.PasswordInput(attrs={'class':'required'}),