fix: auth register api fixed

This commit is contained in:
behruz-dev
2025-07-29 18:01:49 +05:00
parent a697c6a6a3
commit 6bc284f1ec
6 changed files with 32 additions and 47 deletions

View File

@@ -7,12 +7,15 @@ from config.env import env
r = redis.StrictRedis.from_url(env.str('REDIS_URL'))
def cache_user_credentials(phone_number, password, time):
def cache_user_credentials(phone_number, password, first_name, last_name, email, time):
key = f"user_credentials:{phone_number}"
r.hmset(key, {
"phone": phone_number,
"password": password
"password": password,
"first_name": first_name,
"last_name": last_name,
"email": email
})
r.expire(key, time)
@@ -27,5 +30,8 @@ def get_user_creadentials(phone_number):
return {
"phone": data.get(b"phone").decode() if data.get(b"phone") else None,
"password": data.get(b"password").decode() if data.get(b"password") else None
"password": data.get(b"password").decode() if data.get(b"password") else None,
"first_name": data.get(b"first_name").decode() if data.get(b'first_name') else None,
"last_name": data.get(b"last_name").decode() if data.get(b'last_name') else None,
"email": data.get(b"email").decode() if data.get(b'email') else None,
}