我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用flask.ext.login.current_user.ping()。
def manager_app(org_id): # Auth - are they sudo? organization = Organization.query.get_or_404(org_id) if current_user.is_sudo() or organization in current_user.manager_accounts( ): current_user.track_event("visited_manager") current_user.ping(org_id=org_id) resp = make_response( render_template( "manager.html", organization=organization, api_token=current_user.generate_api_token())) resp.headers["Cache-Control"] = "no-store" return resp return abort(403)
def before_request(): if current_user.is_authenticated: current_user.ping() # ??????????? if not current_user.confirmed \ and request.endpoint[:5] != 'auth.' \ and request.endpoint != 'static': return redirect(url_for('auth.unconfirmed')) # ???????
def before_request(): if current_user.is_authenticated: current_user.ping() if not current_user.confirmed and request.endpoint[:5] != 'auth.': return redirect(url_for('auth.unconfirmed'))
def myschedules_app(org_id, location_id, role_id, user_id): # verify route exists user = RoleToUser.query.join(Role).join(Location).join( Organization).filter(RoleToUser.user_id == user_id, Role.id == role_id, Location.id == location_id, Organization.id == org_id).first() RoleToUser.query.filter_by( role_id=role_id, user_id=user_id, archived=False).first_or_404() if user is None: abort(404) # check if sudo or logged in as user if not (current_user.is_sudo() or current_user.id == user_id): return abort(403) current_user.track_event("visited_myschedules") current_user.ping(org_id=org_id) resp = make_response( render_template( "myschedules.html", api_token=current_user.generate_api_token(), org_id=org_id, location_id=location_id, role_id=role_id, user_id=user_id)) resp.headers["Cache-Control"] = "no-store" return resp
def before_request(): if current_user.is_authenticated: current_user.ping() if not current_user.confirmed \ and request.endpoint[:5] != 'auth.' \ and request.endpoint != 'static': return redirect(url_for('auth.unconfirmed'))
def before_request(): if current_user.is_authenticated: current_user.ping() #?????? if not current_user.confirmed \ and request.endpoint[:5] != 'auth.' \ and request.endpoint != 'static': return redirect(url_for('auth.unconfirmed')) #???????