修复注册错误提示不明确的问题
This commit is contained in:
parent
156137ee19
commit
7760a52982
|
|
@ -43,14 +43,14 @@ def register(user_data: UserCreate, db: Session = Depends(get_db)):
|
||||||
if existing_phone:
|
if existing_phone:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail="该手机号已被注册"
|
detail="E00040:该手机号已被注册,请更换手机号"
|
||||||
)
|
)
|
||||||
if user_data.email:
|
if user_data.email:
|
||||||
existing_email = db.query(User).filter(User.email == user_data.email).first()
|
existing_email = db.query(User).filter(User.email == user_data.email).first()
|
||||||
if existing_email:
|
if existing_email:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail="邮箱已被注册"
|
detail="E00041:该邮箱已被注册,请更换邮箱"
|
||||||
)
|
)
|
||||||
|
|
||||||
# 创建用户
|
# 创建用户
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue