def before_request(): set_flicket_config() g.user = current_user # reset the user token if the user is authenticated and token is expired. if g.user.is_authenticated and hasattr(g.user, "token"): if FlicketUser.check_token(g.user.token) is None: g.user.get_token() db.session.commit() # used in the page footer g.__version__ = __version__ # page title application_title = FlicketConfig.query.first().application_title g.application_title = application_title
def verify_token(token): g.current_user = FlicketUser.check_token(token) if token else None return g.current_user is not None