Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10017 closed (fixed)

auth.forms.PasswordResetForm.clean_email returns None

Reported by: Zak Johnson <zakj@…> Owned by: Leo Shklovskii
Component: contrib.auth Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Classes inheriting from PasswordResetForm will be unable to access self.cleaned_data['email'] without a stub clean_email() to return a value:

    def clean_email(self):
        super(MyPasswordResetForm, self).clean_email()
        return self.cleaned_data['email']

Attachments (2)

PasswordResetForm.patch (671 bytes) - added by Zak Johnson <zakj@…> 8 years ago.
10017-tests.patch (1.2 KB) - added by Leo Shklovskii 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by Zak Johnson <zakj@…>

Attachment: PasswordResetForm.patch added

comment:1 Changed 8 years ago by glund@…

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Seems an obvious bug; it just caused us problems - setting to Accepted, I'd suggest this is ready for checkin?

comment:2 Changed 8 years ago by Luke Plant

Triage Stage: AcceptedReady for checkin

comment:3 Changed 8 years ago by Russell Keith-Magee

Triage Stage: Ready for checkinAccepted

Not ready for checkin - requires a test (django/contrib/auth/tests/forms.py). There aren't any tests for the PasswordResetForm at the moment (which is probably why this bug slipped through the cracks), but that's no excuse for not adding them when we have the chance.

comment:4 Changed 8 years ago by Luke Plant

Note that there are tests for the password reset views, and for the PasswordResetTokenGenerator, so in the tests for the PasswordResetForm the scope can be kept nice and narrow (i.e. I wouldn't worry about testing the 'save' method).

Changed 8 years ago by Leo Shklovskii

Attachment: 10017-tests.patch added

comment:5 Changed 8 years ago by Leo Shklovskii

Owner: changed from nobody to Leo Shklovskii
Status: newassigned

I've attached several (possibly gratuitous) tests for PasswordResetForm, including one for this bug.

This would be fantastic to get checked in.

comment:6 Changed 8 years ago by Luke Plant

Resolution: fixed
Status: assignedclosed

(In [9906]) Fixed #10017 - PasswordResetForm.clean_email was not returning the value.

Thanks Zak Johnson, Leo

comment:7 Changed 8 years ago by Luke Plant

(In [9907]) [1.0.X] Fixed #10017 - PasswordResetForm.clean_email was not returning the value.

Thanks Zak Johnson, Leo

Backport of r9906 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top