Exemplo n.º 1
0
def webapp():
    try:
        if not is_authorized():
            return to("auth")
        else:
            config = {'userId': session['id'], 'email': session['email'],}
            return render_template("webapp.html", email=session['email'],
                                   config=json.dumps(config))
    except Exception, exception:
        logger.critical(exception)
        logger.debug(traceback.format_exc())
        return error_page(exception)
Exemplo n.º 2
0
def auth():
    try:
        if not is_identified():
            return to("id")
        # We are here because the user has been identified but NOT authorized.
        user = get_user()
        if not user:
            user = create_user()
        # If our user is already authorized to use the service, skip the
        # authorization and let's go.
        if is_authorized():
            logger.debug("User %s is authorized." % user.id)
            return next_on()
        else:
            logger.debug("User %s is NOT authorized." % user.id)
            # Render the payment page. 
            return payment(user)
    except Exception, exception:
        logger.critical("Exception: %s" % exception)
        logger.debug(traceback.format_exc())
        return error_page(exception)