如何生成符合Django中验证器的密码?
我使用user.objects.make_random_password()
来生成 new 用户的密码,但是我发现此方法正在创建不符合验证器的密码(auth_pass_pass_validators) )在Django中配置。
我还尝试了从django.contrib.auth.hashers导入Make_password
,但是Hashed密码不符合所有密码验证标准,因为太长了。
我想知道是否有一个基于auth_password_validators创建密码的函数?
I used User.objects.make_random_password()
to generate passwords for new users, however I found out that this method was creating passwords which didn't comply with the validators (AUTH_PASSWORD_VALIDATORS) that are configured in Django.
I also tried with from django.contrib.auth.hashers import make_password
, but the hashed password does not match all the password validation criteria because is too long.
I want to know if there is a function which creates passwords based on AUTH_PASSWORD_VALIDATORS?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您应该尝试创建自己的密码创建者。
尝试此功能我为您创建新密码。
Well, you should try to create your own password creator.
Try this function I made for you to create new passwords.