AIdeaText commited on
Commit
40e3c56
·
verified ·
1 Parent(s): 50f776f

Update modules/database/sql_db.py

Browse files
Files changed (1) hide show
  1. modules/database/sql_db.py +5 -7
modules/database/sql_db.py CHANGED
@@ -40,20 +40,18 @@ def create_user(username, password, role, additional_info=None):
40
  return False
41
 
42
  try:
43
- # Generar salt y hash de la contraseña
44
- salt = bcrypt.gensalt()
45
- hashed = bcrypt.hashpw(password.encode('utf-8'), salt)
46
-
47
  user_data = {
48
  'id': username,
49
  'password': password,
50
  'role': role,
51
  'timestamp': datetime.now(timezone.utc).isoformat(),
52
- 'additional_info': additional_info or {},
53
- 'partitionKey': username # Añadir partition key al documento
54
  }
55
 
56
- container.create_item(body=user_data)
 
 
 
57
  logger.info(f"Usuario {role} creado: {username}")
58
  return True
59
 
 
40
  return False
41
 
42
  try:
 
 
 
 
43
  user_data = {
44
  'id': username,
45
  'password': password,
46
  'role': role,
47
  'timestamp': datetime.now(timezone.utc).isoformat(),
48
+ 'additional_info': additional_info or {}
 
49
  }
50
 
51
+ container.create_item(
52
+ body=user_data,
53
+ partition_key=username
54
+ )
55
  logger.info(f"Usuario {role} creado: {username}")
56
  return True
57