API - minor refacto
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
import secrets
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from flask import current_app
|
||||
|
||||
from fittrackee import bcrypt, db
|
||||
from fittrackee import db
|
||||
|
||||
from ..exceptions import InvalidEmailException, UserNotFoundException
|
||||
from ..models import User
|
||||
@ -33,9 +31,7 @@ class UserManagerService:
|
||||
@staticmethod
|
||||
def _reset_user_password(user: User) -> str:
|
||||
new_password = secrets.token_urlsafe(30)
|
||||
user.password = bcrypt.generate_password_hash(
|
||||
new_password, current_app.config.get('BCRYPT_LOG_ROUNDS')
|
||||
).decode()
|
||||
user.password = user.generate_password_hash(new_password)
|
||||
return new_password
|
||||
|
||||
@staticmethod
|
||||
|
Reference in New Issue
Block a user