This commit is contained in:
Administrator 2023-04-14 16:28:55 +08:00
parent 94efcfaab9
commit ad7d197c62
1 changed files with 10 additions and 2 deletions

View File

@ -76,6 +76,7 @@ def change_user_info(req: UserSchemas.ChangeUserInfoReq, token_data: TokenData =
def bind_email(req: UserSchemas.BindEmailReq, def bind_email(req: UserSchemas.BindEmailReq,
db: Session = Depends(get_db)): db: Session = Depends(get_db)):
email = req.email.replace(" ", "") email = req.email.replace(" ", "")
checked = EmailVerifyCode.check_code(email, req.email_code, EmailVerifyType.change) checked = EmailVerifyCode.check_code(email, req.email_code, EmailVerifyType.change)
if not checked: if not checked:
raise HTTPException(detail="邮箱验证码错误", status_code=303) raise HTTPException(detail="邮箱验证码错误", status_code=303)
@ -131,9 +132,16 @@ def login_by_phone(req: UserSchemas.LoginByPhoneReq,
@router.post("/get_email_verify_code", tags=["用户接口"], summary="获取邮箱验证码") @router.post("/get_email_verify_code", tags=["用户接口"], summary="获取邮箱验证码")
def get_email_verify_code(body: UserSchemas.EmailSendReqBody): def get_email_verify_code(body: UserSchemas.EmailSendReqBody, db: Session = Depends(get_db)):
try: try:
email = body.email email = body.email
user = UserCrud.get_user_info(db, email)
# if user:
# # 邮箱已绑定
# if user.email and user.email != req.email:
# raise HTTPException(detail="该微信已绑定邮箱,请使用该微信号绑定的邮箱登录", status_code=403)
if not user:
raise HTTPException(detail="邮箱未录入系统", status_code=303)
EmailVerifyCode.send_change_code(email) EmailVerifyCode.send_change_code(email)
except HTTPException as e: except HTTPException as e:
raise e raise e
@ -174,7 +182,7 @@ def get_user_by_department_type(body: UserSchemas.GetUserByDepartmentTypeReq,
@router.post("/get_user_can_watch_department", tags=["获取用户可查看部门列表"], summary=['查询']) @router.post("/get_user_can_watch_department", tags=["获取用户可查看部门列表"], summary=['查询'])
def get_user_can_watch_department(token_data: TokenData = Depends(token_data_depend), db: Session = Depends(get_db)): def get_user_can_watch_department(token_data: TokenData = Depends(token_data_depend), db: Session = Depends(get_db)):
print(token_data) print(token_data)
department_list = [item.to_dict() for item in UserCrud.get_department_list(db) if item.id not in [1,2,3]] department_list = [item.to_dict() for item in UserCrud.get_department_list(db) if item.id not in [1, 2, 3]]
department_dict = {item['id']: item for item in department_list} department_dict = {item['id']: item for item in department_list}
# 所有部门动态查看 # 所有部门动态查看
if check_auth(token_data.auth_data, [2]): if check_auth(token_data.auth_data, [2]):