feat: 删除登录即注册逻辑,登录时用户不存在直接报错

- login_with_sms: get_or_create_by_mobile → get_by_mobile
- 用户不存在时返回 ValueError('用户不存在')
- send_code 保留用户存在性校验
This commit is contained in:
小鱼开发
2026-05-08 21:11:05 +08:00
parent 12f4e2f3e7
commit 105025ae4d
+4 -4
View File
@@ -193,10 +193,10 @@ async def login_with_sms(
if not await verify_sms_code(mobile, code):
raise ValueError("验证码错误或已过期")
# 2. 获取或创建用户
user = await user_crud.get_or_create_by_mobile(
db, mobile=mobile, source=source
)
# 2. 查询用户(不再自动注册)
user = await user_crud.get_by_mobile(db, mobile=mobile)
if user is None:
raise ValueError("用户不存在")
# 检查用户状态
if not user.is_active: