Well.. you're creating hashed password, but not saving it anywhere. And because you're saving form (which inherits from ModelForm), the password fields is saved straight from the password form field.
You can override save method and set hashpass
as password. But I think the best practice here is to use UserCreationForm
which handles password hashing for you (it will use the first password hasher from your list).
There are some examples here on SO, showing how to customize UserCreationForm, so search around.
Pseudo-code:
forms.py
from django.contrib.auth.forms import UserCreationForm
class RegisterForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super(RegisterForm, self).__init__(*args, **kwargs)
# do not require password confirmation
del self.fields['password2']
views.py
def home(request):
form = RegisterForm()
if request.method == "POST":
form = RegisterForm(request.POST)
if form.is_valid():
user = form.save()
# redirect!
return render(request, 'home.html', {
'form': form
})