Skip to content
Merged

Beta #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""empty message

Revision ID: ad0ca8c2e5fe
Revision ID: b07da2e750df
Revises:
Create Date: 2025-08-13 08:54:49.181927
Create Date: 2025-08-19 21:00:25.203060

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ad0ca8c2e5fe'
revision = 'b07da2e750df'
down_revision = None
branch_labels = None
depends_on = None
Expand Down
7 changes: 6 additions & 1 deletion src/api/routes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ def register_user():
body['password'].encode(), bcrypt.gensalt()) # encriptar password
print(new_password)

admin_list = [e.strip() for e in os.getenv(
"ADMIN_EMAILS", "").split(",") if e.strip()]

is_admin = body["email"] in admin_list

if "username" and "email" and "password" not in body:
return jsonify("Error, debes introducir los campos obligatorios"), 404

Expand All @@ -84,7 +89,7 @@ def register_user():
new_user.email = body["email"]
new_user.password = new_password.decode()
new_user.is_active = True
new_user.is_admin = False
new_user.is_admin = is_admin
db.session.add(new_user)
db.session.commit()

Expand Down