小编Har*_*rsh的帖子

如何使用 Django 生成基于时间的一次性密码(OTP)

我使用以下代码生成一个随机字符串作为 OTP -

from django.utils.crypto import get_random_string

otp = get_random_string(6, allowed_chars='0123456789')
Run Code Online (Sandbox Code Playgroud)

问题在于,由于短信发送问题,人们要求提供大量 OTP,然后当他们一起到达时,他们不知道哪一个当前有效。

我想生成一个30 分钟内不会改变的 OTP ,并且对于每个电话号码都是唯一的,例如+919999999999

python django python-3.x

1
推荐指数
1
解决办法
3604
查看次数

标签 统计

django ×1

python ×1

python-3.x ×1