jcugat / django-custom-user

Custom user model for Django with the same behaviour as the default User class but with email instead of username.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EmailUserChangeForm assumes clean_password can't fail.

kezabelle opened this issue · comments

Should the EmailUserChangeForm be used in such a way as only a subset of fields are set, return self.initial["password"] may fail because password isn't in self.initial, resulting in a KeyError ...

I have no idea what the rationale is for returning the initial password (nor where it's even set), but it should probably be done in the safer form of return self.initial.get('password', '') ... substituting '' for None if applicable.

Hi Keryn,

I don't understand the issue. The code of EmailUserChangeForm is taken directly from Django: https://github.com/django/django/blob/1.6.1/django/contrib/auth/forms.py#L147

Both EmailUserChangeForm and EmailUserCreationForm are used in the AdminSite. Maybe you are using the form somewhere else?

Closing due to inactivity.