This aswer suggests the use of the make_random_password, but it is deprecated since Django 4.2. I assume there is a good reason for eliminating this fuction, so what should I use instead?
I searched for alternatives, but could not find any native to Django. I can create my own solution using hashlib, but should I?
It’s very easy to implement this function.
import secrets
def make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
return ''.join(secrets.choice(allowed_chars) for i in range(length))