Index: django/contrib/auth/forms.py
===================================================================
--- django/contrib/auth/forms.py	(revision 8061)
+++ django/contrib/auth/forms.py	(working copy)
@@ -14,11 +14,11 @@
         error_message = _("This value must contain only letters, numbers and underscores."))
     password1 = forms.CharField(label=_("Password"), max_length=60, widget=forms.PasswordInput)
     password2 = forms.CharField(label=_("Password confirmation"), max_length=60, widget=forms.PasswordInput)
-    
+
     class Meta:
         model = User
         fields = ("username",)
-    
+
     def clean_username(self):
         username = self.cleaned_data["username"]
         try:
@@ -26,14 +26,14 @@
         except User.DoesNotExist:
             return username
         raise forms.ValidationError(_("A user with that username already exists."))
-    
+
     def clean_password2(self):
         password1 = self.cleaned_data["password1"]
         password2 = self.cleaned_data["password2"]
         if password1 != password2:
             raise forms.ValidationError(_("The two password fields didn't match."))
         return password2
-    
+
     def save(self, commit=True):
         user = super(UserCreationForm, self).save(commit=False)
         user.set_password(self.cleaned_data["password1"])
@@ -46,9 +46,9 @@
     Base class for authenticating users. Extend this to get a form that accepts
     username/password logins.
     """
-    username = forms.CharField(label=_("Username"), max_length=30)
-    password = forms.CharField(label=_("Password"), max_length=30, widget=forms.PasswordInput)
-    
+    username = forms.CharField(label=_("Username"))
+    password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
+
     def __init__(self, request=None, *args, **kwargs):
         """
         If request is passed in, the form will validate that cookies are
@@ -59,36 +59,36 @@
         self.request = request
         self.user_cache = None
         super(AuthenticationForm, self).__init__(*args, **kwargs)
-    
+
     def clean(self):
         username = self.cleaned_data.get('username')
         password = self.cleaned_data.get('password')
-        
+
         if username and password:
             self.user_cache = authenticate(username=username, password=password)
             if self.user_cache is None:
                 raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
             elif not self.user_cache.is_active:
                 raise forms.ValidationError(_("This account is inactive."))
-        
+
         # TODO: determine whether this should move to its own method.
         if self.request:
             if not self.request.session.test_cookie_worked():
                 raise forms.ValidationError(_("Your Web browser doesn't appear to have cookies enabled. Cookies are required for logging in."))
-        
+
         return self.cleaned_data
-    
+
     def get_user_id(self):
         if self.user_cache:
-            return self.user_cache.id
+            return self.user_cache.pk
         return None
-    
+
     def get_user(self):
         return self.user_cache
 
 class PasswordResetForm(forms.Form):
     email = forms.EmailField(label=_("E-mail"), max_length=40)
-    
+
     def clean_email(self):
         """
         Validates that a user exists with the given e-mail address.
@@ -97,7 +97,7 @@
         self.users_cache = User.objects.filter(email__iexact=email)
         if len(self.users_cache) == 0:
             raise forms.ValidationError(_("That e-mail address doesn't have an associated user account. Are you sure you've registered?"))
-    
+
     def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'):
         """
         Calculates a new password randomly and sends it to the user.
@@ -131,11 +131,11 @@
     old_password = forms.CharField(label=_("Old password"), max_length=30, widget=forms.PasswordInput)
     new_password1 = forms.CharField(label=_("New password"), max_length=30, widget=forms.PasswordInput)
     new_password2 = forms.CharField(label=_("New password confirmation"), max_length=30, widget=forms.PasswordInput)
-    
+
     def __init__(self, user, *args, **kwargs):
         self.user = user
         super(PasswordChangeForm, self).__init__(*args, **kwargs)
-    
+
     def clean_old_password(self):
         """
         Validates that the old_password field is correct.
@@ -144,7 +144,7 @@
         if not self.user.check_password(old_password):
             raise forms.ValidationError(_("Your old password was entered incorrectly. Please enter it again."))
         return old_password
-    
+
     def clean_new_password2(self):
         password1 = self.cleaned_data.get('new_password1')
         password2 = self.cleaned_data.get('new_password2')
@@ -152,7 +152,7 @@
             if password1 != password2:
                 raise forms.ValidationError(_("The two password fields didn't match."))
         return password2
-    
+
     def save(self, commit=True):
         self.user.set_password(self.cleaned_data['new_password1'])
         if commit:
@@ -165,11 +165,11 @@
     """
     password1 = forms.CharField(label=_("Password"), max_length=60, widget=forms.PasswordInput)
     password2 = forms.CharField(label=_("Password (again)"), max_length=60, widget=forms.PasswordInput)
-    
+
     def __init__(self, user, *args, **kwargs):
         self.user = user
         super(AdminPasswordChangeForm, self).__init__(*args, **kwargs)
-    
+
     def clean_password2(self):
         password1 = self.cleaned_data.get('password1')
         password2 = self.cleaned_data.get('password2')
@@ -177,7 +177,7 @@
             if password1 != password2:
                 raise forms.ValidationError(_("The two password fields didn't match."))
         return password2
-    
+
     def save(self, commit=True):
         """
         Saves the new password.
