update
This commit is contained in:
parent
73418553c7
commit
6e9775f530
@ -329,9 +329,20 @@ async def password_login(
|
||||
if not verify_password(login_data.password, user.password):
|
||||
return error_response(code=401, message="密码错误")
|
||||
|
||||
if login_data.role == UserRole.ADMIN:
|
||||
if UserRole.ADMIN not in user.roles:
|
||||
return error_response(code=401, message="管理员账户,请先设置管理员角色")
|
||||
if login_data.role == UserRole.ADMIN and UserRole.ADMIN not in user.roles:
|
||||
return error_response(code=401, message="你没有登录权限")
|
||||
|
||||
if login_data.role == UserRole.PARTNER and UserRole.PARTNER not in user.roles:
|
||||
return error_response(code=401, message="你没有登录权限")
|
||||
|
||||
if login_data.role == UserRole.MERCHANT and UserRole.MERCHANT not in user.roles:
|
||||
return error_response(code=401, message="你没有登录权限")
|
||||
|
||||
if login_data.role == UserRole.DELIVERYMAN and UserRole.DELIVERYMAN not in user.roles:
|
||||
return error_response(code=401, message="你没有登录权限")
|
||||
|
||||
if login_data.role == UserRole.USER and UserRole.USER not in user.roles:
|
||||
return error_response(code=401, message="你没有登录权限")
|
||||
|
||||
if login_data.role == UserRole.MERCHANT and UserRole.MERCHANT in user.roles:
|
||||
# 检查是否有商家设置了当前用户 id
|
||||
|
||||
Loading…
Reference in New Issue
Block a user