From f421c3d09730ec4e704355d1d0ce9345aea64025 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Mon, 17 Feb 2025 14:42:06 +0800 Subject: [PATCH] update --- app/api/endpoints/user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/user.py b/app/api/endpoints/user.py index e87a8a2..cef90a9 100644 --- a/app/api/endpoints/user.py +++ b/app/api/endpoints/user.py @@ -309,17 +309,17 @@ async def password_login( if not verify_password(login_data.password, user.password): return error_response(code=401, message="密码错误") - if login_data.platform == Platform.ADMIN: + if login_data.role == UserRole.ADMIN: if UserRole.ADMIN not in user.roles: return error_response(code=401, message="管理员账户,请先设置管理员角色") - if login_data.platform == Platform.MERCHANT and UserRole.MERCHANT in user.roles: + if login_data.role == UserRole.MERCHANT and UserRole.MERCHANT in user.roles: # 检查是否有商家设置了当前用户 id merchant = db.query(MerchantDB).filter(MerchantDB.user_id == user.userid).first() if not merchant: return error_response(code=401, message="商家账户,请先关联商家") - if login_data.platform == Platform.DELIVERYMAN and UserRole.DELIVERYMAN in user.roles and not user.community_id: + if login_data.role == UserRole.DELIVERYMAN and UserRole.DELIVERYMAN in user.roles and not user.community_id: return error_response(code=401, message="配送员账户,请先设置归属小区") # 生成访问令牌