def post_validPasswordEmail(): params = request.get_json() if 'userid' not in params: return jsonify(Common.falseReturn(None, 'please input userid')) #根据id获取email userinfo = UserApi.getUserInfoByUserid(params.get('userid')) if userinfo['status']: return jsonify( ValidEmail.post_validcode_email(userinfo['data']['email'], "修改密码", 1)) else: return jsonify(Common.falseReturn(None, 'no user'))
def reset_password(): params = request.get_json() if not params.get('emailcode') or not params.get( 'userid') or not params.get('password'): return jsonify( Common.falseReturn( None, 'emailcode and userid and password should not empty')) userbase = UserApi.getUserBase(params.get('userid')) if userbase['status']: userinfo = UserApi.getUserInfoByUserid(userbase['data']['id']) if userinfo['status']: res = ValidEmail.check_validcode_email(userinfo['data']['email'], params.get('emailcode'), 1) if res['status']: return jsonify( UserApi.updateUserPassword(params.get('userid'), params.get('password'))) else: return jsonify(Common.falseReturn(None, 'check code wrong')) else: return jsonify(Common.falseReturn(None, 'get email wrong')) else: return jsonify(Common.falseReturn(None, 'user not exist'))
def get_userinfo(): userid = IdentifyUtil.get_user_id() if not userid: return jsonify(Common.falseReturn(None, 'user not find')) return jsonify(UserApi.getUserInfoByUserid(userid))
def get_UserEmail(userid): res = UserApi.getUserInfoByUserid(userid) if res['status']: return jsonify(Common.trueReturn(res['data']['email'], 'ok')) return jsonify(Common.falseReturn(None, 'no user'))