diff --git a/src/api/users.py b/src/api/users.py index 93a5fe9..92dc6d0 100644 --- a/src/api/users.py +++ b/src/api/users.py @@ -99,6 +99,10 @@ async def register(reg_data: Annotated[RegisterData, Body()]) -> UserData: if user is not None: raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail="Username already taken") + user = await User.find_one(User.email == reg_data.email) + if user is not None: + raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail="Email already taken") + user = await reg_data.create_user() return UserData.from_user(user)