Does not generate the password hash my User

44 views
Skip to first unread message

Ricardo Kamada

unread,
Dec 5, 2013, 2:54:44 PM12/5/13
to django...@googlegroups.com
I have a model "Cliente" and in it a field "password".
In forms.py file, I am using ModelForm, but put in the password field
Password = forms.CharField (widget = forms.PasswordInput (render_value = True))
It turns out that the admin password field appears readable, and I do not want that to happen.
I tried to put in set_password. Models but did not succeed.
Now if I put in the admin:
form = FormCliente
Displays the password field and confirm password type password.
But I will not so I want to appear only the password hash.

in line 19 does not generate the password hash, but the readable password

Ricardo

Tom Lockhart

unread,
Dec 5, 2013, 4:27:28 PM12/5/13
to django...@googlegroups.com
render_value=False seems to be helpful here.

Also, in my forms (copied from Mezzanine) there are two fields defined, "password1" and "password2", both with render_value=False, and then the actual password is set after validating the second against the first.

hth

                - Tom


Ricardo

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJTdXTGzao5CaAfX9b%3Dyy_%2BG6LeEcSV1FA7Z11tALZ2WYR4XhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tom Lockhart


Ricardo

unread,
Dec 5, 2013, 6:55:53 PM12/5/13
to django...@googlegroups.com
Hi Thomas.
Even entering rende_value = False does not. The password keeps popping up as text.
did not quite understand how that password1 is inserted before the check password2.
I could not see this problem.

Thomas Lockhart

unread,
Dec 5, 2013, 7:04:58 PM12/5/13
to django...@googlegroups.com
On 12/5/13 3:55 PM, Ricardo wrote:
Hi Thomas.
Even entering rende_value = False does not. The password keeps popping up as text.
did not quite understand how that password1 is inserted before the check password2.
I could not see this problem.
You have found the limits of my knowledge. If it were me I would download the Mezzanine code (which solves this nicely) and borrow a few lines. That is what I did...

hth

                               - Tom


Em quinta-feira, 5 de dezembro de 2013 17h54min44s UTC-2, Ricardo escreveu:
I have a model "Cliente" and in it a field "password".
In forms.py file, I am using ModelForm, but put in the password field
Password = forms.CharField (widget = forms.PasswordInput (render_value = True))
It turns out that the admin password field appears readable, and I do not want that to happen.
I tried to put in set_password. Models but did not succeed.
Now if I put in the admin:
form = FormCliente
Displays the password field and confirm password type password.
But I will not so I want to appear only the password hash.

in line 19 does not generate the password hash, but the readable password

Ricardo
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

Ricardo

unread,
Dec 5, 2013, 7:21:40 PM12/5/13
to django...@googlegroups.com
Ok


Em quinta-feira, 5 de dezembro de 2013 17h54min44s UTC-2, Ricardo escreveu:

Jérôme Thiard

unread,
Dec 9, 2013, 7:37:21 AM12/9/13
to django...@googlegroups.com
The problem is  that you have a `password` field in your `Cliente` model. So the `ClienteForm` save the readable value of the password in the Cliente model.

You should not have this field in the model. Instead override the save method of your `ClientForm` to create the user in the form and not in the model.
That way the password will be stored only hashed, and only in the User model.

cheers,

Jérôme


2013/12/6 Ricardo <ricard...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

Ricardo Kamada

unread,
Dec 9, 2013, 11:23:26 AM12/9/13
to django...@googlegroups.com
Thanks for the reply Jérôme.
Know what it says but said if I just edit the save of the form () i lose the login form because the save () the model User.objects.create_user (self.email, self.email, self.password)

Ricardo

Ricardo


2013/12/9 Jérôme Thiard <jerome...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/S5dUX4OXkJo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages