Tuesday, August 30, 2011

Password Field Not being encrypted

Hey guys, I'm trying to make a custom registration form for a custom
UserProfile class.
I have the following form:

class UserForm(ModelForm):
username = forms.EmailField(label = _("Email"), widget =
forms.TextInput(attrs ={ 'id':'email'}), required=True)
first_name = forms.CharField(widget = forms.TextInput(attrs =
{'id':'fname'}), required=True)
last_name = forms.CharField(widget = forms.TextInput(attrs =
{'id':'lname'}), required=True)
linked_id = forms.CharField(widget = forms.HiddenInput(attrs =
password = forms.CharField(label=_('Password'),
widget=forms.PasswordInput(render_value = False), required = True)
password2 = forms.CharField(label=_('Re-Enter your password'), widget
= forms.PasswordInput(render_value = False))
email = forms.CharField(widget = forms.HiddenInput(), required =

class Meta:
model = UserProfile
fields = ('username', 'first_name', 'last_name', 'linked_id',
'password', 'email', )

def clean_password2(self):
password1 = self.cleaned_data.get("password", "")
password2 = self.cleaned_data['password2']
if password1 != password2:
raise forms.ValidationError(_("The passwords you entered did not
return password2

def clean_email(self):
email = self.cleaned_data['username']
return email

The issue that I'm having is that when the password is entered, and
saved, its not being encrypted. So I can just view a users password in
my admin panel...
How do I get the passwords to be encrypted? I had another website and
it worked then, but when I'm trying it now, it just isn't working.
Help please. Thank you.

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment