set_password(raw_password)
Sets the user’s password to the given raw string, taking care of the password hashing. Doesn’t save the User object.
check_password(raw_password)
Returns True if the given raw string is the correct password for the user. (This takes care of the password hashing in making the comparison.)
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0429a2cd-a16c-429f-98b5-938629073ca5%40googlegroups.com.
--
I agree with Adam, but in this case it seems to pose a security risk in case of user mistake, as such, raising a ValueError would have protect against the mistake of passing empty passwords, unless you consider empty passwords a feature of course in which case please dismiss my email.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9Xx6DvMQMWVWMRYMhbK-8nXfyPrNU_5ljWd-YuXeXRmz3_pnYXT6axEYrDBfW4K1v5OGEshIR2SDAeZxpnDBSk6SMLe4oeiwcrDMnz7xah4%3D%40protonmail.com.
make_password(password, salt=None, hasher='default')
Creates a hashed password in the format used by this application. It takes one mandatory argument: the password in plain-text.
User provided passwords are validated already: https://docs.djangoproject.com/en/3.0/topics/auth/passwords/#module-django.contrib.auth.password_validationWhen using set_password directly, you as the programmer are responsible for ensuring the value you use for password is valid. Normally this means calling the functions detailed in "Integrating validation" beforehand.
--Adam
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/bda75e4c-2dae-42ef-91f3-c3054031c800%40googlegroups.com.
Tom
To unsubscribe from this group and stop receiving emails from it, send an email to django-d...@googlegroups.com.
The behavior of the make_password method is quite surprising to be honest
maybe the advantages of being able to pass any object into the method is entirely academic because nobody passes anything but strings on purpose
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAHzshFuQnEUrAdk53apDWw3wnPBNq%2BYQE9bxyfOpbFfyQS04dw%40mail.gmail.com.
One question I have is - did you experience any real world issue with this?
Django takes security seriously and helps developers avoid many common security mistakes.
We could add type guards to many of the thousands of functions in Django to prevent potential bugs.
I think that the root question here is: should we allow users to create passwords from anything that is not str?