Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleaned up whitespace

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8214 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8e24b3761084618fa259f6499b1a9110d19a28c2 1 parent 9b4ff7c
Luke Plant authored August 05, 2008

Showing 1 changed file with 18 additions and 18 deletions. Show diff stats Hide diff stats

  1. 36  django/contrib/auth/forms.py
36  django/contrib/auth/forms.py
@@ -16,11 +16,11 @@ class UserCreationForm(forms.ModelForm):
16 16
         error_message = _("This value must contain only letters, numbers and underscores."))
17 17
     password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
18 18
     password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput)
19  
-    
  19
+
20 20
     class Meta:
21 21
         model = User
22 22
         fields = ("username",)
23  
-    
  23
+
24 24
     def clean_username(self):
25 25
         username = self.cleaned_data["username"]
26 26
         try:
@@ -28,14 +28,14 @@ def clean_username(self):
28 28
         except User.DoesNotExist:
29 29
             return username
30 30
         raise forms.ValidationError(_("A user with that username already exists."))
31  
-    
  31
+
32 32
     def clean_password2(self):
33 33
         password1 = self.cleaned_data["password1"]
34 34
         password2 = self.cleaned_data["password2"]
35 35
         if password1 != password2:
36 36
             raise forms.ValidationError(_("The two password fields didn't match."))
37 37
         return password2
38  
-    
  38
+
39 39
     def save(self, commit=True):
40 40
         user = super(UserCreationForm, self).save(commit=False)
41 41
         user.set_password(self.cleaned_data["password1"])
@@ -50,7 +50,7 @@ class AuthenticationForm(forms.Form):
50 50
     """
51 51
     username = forms.CharField(label=_("Username"), max_length=30)
52 52
     password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
53  
-    
  53
+
54 54
     def __init__(self, request=None, *args, **kwargs):
55 55
         """
56 56
         If request is passed in, the form will validate that cookies are
@@ -61,36 +61,36 @@ def __init__(self, request=None, *args, **kwargs):
61 61
         self.request = request
62 62
         self.user_cache = None
63 63
         super(AuthenticationForm, self).__init__(*args, **kwargs)
64  
-    
  64
+
65 65
     def clean(self):
66 66
         username = self.cleaned_data.get('username')
67 67
         password = self.cleaned_data.get('password')
68  
-        
  68
+
69 69
         if username and password:
70 70
             self.user_cache = authenticate(username=username, password=password)
71 71
             if self.user_cache is None:
72 72
                 raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
73 73
             elif not self.user_cache.is_active:
74 74
                 raise forms.ValidationError(_("This account is inactive."))
75  
-        
  75
+
76 76
         # TODO: determine whether this should move to its own method.
77 77
         if self.request:
78 78
             if not self.request.session.test_cookie_worked():
79 79
                 raise forms.ValidationError(_("Your Web browser doesn't appear to have cookies enabled. Cookies are required for logging in."))
80  
-        
  80
+
81 81
         return self.cleaned_data
82  
-    
  82
+
83 83
     def get_user_id(self):
84 84
         if self.user_cache:
85 85
             return self.user_cache.id
86 86
         return None
87  
-    
  87
+
88 88
     def get_user(self):
89 89
         return self.user_cache
90 90
 
91 91
 class PasswordResetForm(forms.Form):
92 92
     email = forms.EmailField(label=_("E-mail"), max_length=75)
93  
-    
  93
+
94 94
     def clean_email(self):
95 95
         """
96 96
         Validates that a user exists with the given e-mail address.
@@ -151,14 +151,14 @@ def save(self, commit=True):
151 151
         if commit:
152 152
             self.user.save()
153 153
         return self.user
154  
-    
  154
+
155 155
 class PasswordChangeForm(SetPasswordForm):
156 156
     """
157 157
     A form that lets a user change his/her password by entering
158 158
     their old password.
159 159
     """
160 160
     old_password = forms.CharField(label=_("Old password"), widget=forms.PasswordInput)
161  
-    
  161
+
162 162
     def clean_old_password(self):
163 163
         """
164 164
         Validates that the old_password field is correct.
@@ -168,18 +168,18 @@ def clean_old_password(self):
168 168
             raise forms.ValidationError(_("Your old password was entered incorrectly. Please enter it again."))
169 169
         return old_password
170 170
 PasswordChangeForm.base_fields.keyOrder = ['old_password', 'new_password1', 'new_password2']
171  
-    
  171
+
172 172
 class AdminPasswordChangeForm(forms.Form):
173 173
     """
174 174
     A form used to change the password of a user in the admin interface.
175 175
     """
176 176
     password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
177 177
     password2 = forms.CharField(label=_("Password (again)"), widget=forms.PasswordInput)
178  
-    
  178
+
179 179
     def __init__(self, user, *args, **kwargs):
180 180
         self.user = user
181 181
         super(AdminPasswordChangeForm, self).__init__(*args, **kwargs)
182  
-    
  182
+
183 183
     def clean_password2(self):
184 184
         password1 = self.cleaned_data.get('password1')
185 185
         password2 = self.cleaned_data.get('password2')
@@ -187,7 +187,7 @@ def clean_password2(self):
187 187
             if password1 != password2:
188 188
                 raise forms.ValidationError(_("The two password fields didn't match."))
189 189
         return password2
190  
-    
  190
+
191 191
     def save(self, commit=True):
192 192
         """
193 193
         Saves the new password.

0 notes on commit 8e24b37

Please sign in to comment.
Something went wrong with that request. Please try again.