Django密码生成器 [英] Django Password Generator

查看:112
本文介绍了Django密码生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将一堆用户及其数据导入django项目。我需要为每个分配一个密码。这是一个代码片段,用于生成密码,将处理Django哈希和盐?

I have imported a heap of users and their data to a django project. I need to assign a password to each. Is the such a snippet out there for password generation that will cope with the Django hash and salt?

推荐答案

您还可以使用内置功能 make_random_password

You can also use the built in function make_random_password

for user in new_users:
    password = User.objects.make_random_password()
    user.set_password(password)
    # email/print password

这篇关于Django密码生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆