reset endpoint + frontend reset and login pages add

This commit is contained in:
2026-09-26 19:26:57 +03:00
parent 489014667c
commit bcdf2b5154
32 changed files with 294 additions and 38 deletions
+12
View File
@@ -1,4 +1,6 @@
import hashlib
import secrets
import string
from datetime import UTC, datetime, timedelta
from uuid import uuid4
@@ -22,6 +24,16 @@ class HashService:
def token_to_hash(self, token:str)->str:
return hashlib.sha256(token.encode("utf-8")).hexdigest()
async def generate_temp_password(self, length:int=16)->str:
SPECIAL = "$@#%!^&*()-_+=[]{}"
groups = [string.ascii_uppercase, string.ascii_lowercase, string.digits, SPECIAL]
chars = [secrets.choice(g) for g in groups] # по одному из каждой группы
pool = "".join(groups)
chars += [secrets.choice(pool) for _ in range(length - len(chars))]
secrets.SystemRandom().shuffle(chars) # чтобы спецсимвол не всегда стоял первым
return "".join(chars)
'''jwt'''