diff --git a/endpoints/signup.post.py b/endpoints/signup.post.py index 77e4d09..796ae8a 100644 --- a/endpoints/signup.post.py +++ b/endpoints/signup.post.py @@ -1,50 +1,27 @@ -from fastapi import APIRouter, HTTPException, Depends -from sqlalchemy.orm import Session -from pydantic import BaseModel -from core.database import get_db -from core.auth import get_password_hash, create_access_token -import uuid -from models.user import User +from fastapi import APIRouter, HTTPException + +users = [] # In-memory storage router = APIRouter() -class UserCreate(BaseModel): - username: str - email: str - password: str - -@router.post("/signup") -async def signup( - user_data: UserCreate, - db: Session = Depends(get_db) +@router.post("/reset-password") +async def reset_password_demo( + email: str = "user@example.com", + new_password: str = "newpassword123" ): - """User registration endpoint""" - # Check existing user - db_user = db.query(User).filter( - (User.username == user_data.username) | - (User.email == user_data.email) - ).first() - - if db_user: - raise HTTPException( - status_code=400, - detail="Username or email already exists" - ) + """Demo reset password endpoint""" + user = next((u for u in users if u["email"] == email), None) + if not user: + raise HTTPException(status_code=400, detail="Email not found") - # Create new user - new_user = User( - id=str(uuid.uuid4()), - username=user_data.username, - email=user_data.email, - hashed_password=get_password_hash(user_data.password) - ) - - db.add(new_user) - db.commit() + user["password"] = new_password - # Return token directly after registration return { - "message": "User created successfully", - "access_token": create_access_token({"sub": new_user.id}), - "token_type": "bearer" - } + "message": "Password reset successful", + "user_id": user["id"], + "email": email, + "next_steps": [ + "Login with new password", + "Review security settings" + ] + } \ No newline at end of file