예제 #1
0
파일: webapp.py 프로젝트: hdemers/passwrd
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)
예제 #2
0
파일: auth.py 프로젝트: hdemers/passwrd
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)