Update modules/auth.py
Browse files- modules/auth.py +7 -2
modules/auth.py
CHANGED
|
@@ -57,9 +57,14 @@ def register_user(username, password, role, additional_info=None):
|
|
| 57 |
'additional_info': additional_info or {}
|
| 58 |
}
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
return True
|
| 62 |
-
except exceptions.CosmosHttpResponseError:
|
|
|
|
| 63 |
return False
|
| 64 |
|
| 65 |
def authenticate_user(username, password):
|
|
|
|
| 57 |
'additional_info': additional_info or {}
|
| 58 |
}
|
| 59 |
|
| 60 |
+
# Modificamos esta línea para incluir el partition_key en el cuerpo del documento
|
| 61 |
+
new_user['partitionKey'] = username
|
| 62 |
+
|
| 63 |
+
# Ahora creamos el item sin especificar partition_key como un argumento separado
|
| 64 |
+
container.create_item(body=new_user)
|
| 65 |
return True
|
| 66 |
+
except exceptions.CosmosHttpResponseError as e:
|
| 67 |
+
print(f"Error al registrar usuario: {str(e)}")
|
| 68 |
return False
|
| 69 |
|
| 70 |
def authenticate_user(username, password):
|