Skip to content

Commit

Permalink
Remove generate_random_password method, will be deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Feb 14, 2024
1 parent a4217cc commit e0b9470
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import secrets
import string

from django.conf import settings
from django.contrib.auth.management.commands.createsuperuser import (
Expand Down Expand Up @@ -50,7 +52,8 @@ def handle(self, **options):
user = qs.get()

if not password and options["generate_password"]:
password = self.UserModel.objects.make_random_password(length=20)
alphabet = string.ascii_letters + string.digits
password = "".join(secrets.choice(alphabet) for _ in range(20))

if password:
self.stdout.write("Setting user password...")
Expand Down

0 comments on commit e0b9470

Please sign in to comment.