Generate bigger secret with sha224.

This commit is contained in:
Ignacio Fiorentino 2016-10-26 17:04:12 -03:00
parent 3711d6c5ab
commit 4d2bdb9a97

View file

@ -1,4 +1,4 @@
from hashlib import md5 from hashlib import sha224
from random import randint from random import randint
from uuid import uuid4 from uuid import uuid4
@ -36,12 +36,12 @@ class ClientForm(ModelForm):
if instance and instance.pk: if instance and instance.pk:
if (self.cleaned_data['client_type'] == 'confidential') and not instance.client_secret: if (self.cleaned_data['client_type'] == 'confidential') and not instance.client_secret:
secret = md5(uuid4().hex.encode()).hexdigest() secret = sha224(uuid4().hex.encode()).hexdigest()
elif (self.cleaned_data['client_type'] == 'confidential') and instance.client_secret: elif (self.cleaned_data['client_type'] == 'confidential') and instance.client_secret:
secret = instance.client_secret secret = instance.client_secret
else: else:
if (self.cleaned_data['client_type'] == 'confidential'): if (self.cleaned_data['client_type'] == 'confidential'):
secret = md5(uuid4().hex.encode()).hexdigest() secret = sha224(uuid4().hex.encode()).hexdigest()
return secret return secret