mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
make random password generation safe
This commit is contained in:
parent
3b39049c20
commit
6853ec0b69
@ -13,7 +13,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
import random
|
||||
import secrets
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
@ -85,7 +85,7 @@ class SubscriptionForm(forms.ModelForm):
|
||||
date_of_birth=self.cleaned_data.get("date_of_birth"),
|
||||
)
|
||||
u.generate_username()
|
||||
u.set_password(str(random.randrange(1000000, 10000000)))
|
||||
u.set_password(secrets.token_urlsafe(nbytes=10))
|
||||
u.save()
|
||||
cleaned_data["member"] = u
|
||||
elif cleaned_data.get("member") is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user