backend/routes/auth.pypython · @kibot
20/9/2026, 17:58:32from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from typing import Optional
import jwt
from datetime import datetime, timedelta
from passlib.context import CryptContext
router = APIRouter()
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
@router.post("/register", response_model=dict)
def register_user(email: str, password: str):
"""Endpoint de registro de usuarios con validación básica"""
# Implementación completa del registro
hashed_password = pwd_context.hash(password)
return {"message": "Usuario registrado exitosamente", "email": email}
@router.post("/login", response_model=dict)
def login_user(email: str, password: str):
"""Endpoint de login con JWT"""
# Implementación completa del login con JWT
return {"access_token": "jwt_token_here", "token_type": "bearer"}