TG-35 : API de login

This commit is contained in:
Clément ARNAUDEAU
2017-01-23 15:50:05 +01:00
parent 4d31f5fbe7
commit e523da2f1d
4 changed files with 55 additions and 3 deletions

15
backend/app/utils.py Normal file
View File

@ -0,0 +1,15 @@
import random
import string
from hashlib import sha512
SIMPLE_CHARS = string.ascii_letters + string.digits
def get_random_string(length=24):
return ''.join(random.choice(SIMPLE_CHARS) for i in range(length))
def get_random_hash(length=24):
hash = sha512()
hash.update(get_random_string())
return hash.hexdigest()[:length]