Example #1
0
        'a bad password), or your browser doesn\'t understand how to supply '
        'the credentials required.</p><p>In case you are allowed to request '
        'the document, please check your user-id and password and try '
        'again.</p>'
    )
    return make_response(html, 401)


def json_response(json):
    return Response(json, mimetype='application/json')

login_manager.anonymous_user = Anonymous
login_manager.login_view = "login"
login_manager.login_message = u"Please log in to access this page."
login_manager.refresh_view = "reauth"
login_manager.unauthorized_callback = unauthorized_callbacks

login_manager.setup_app(app)


@cache.cached(timeout=3600)
@app.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(app.root_path, 'static'),
                               'img/favicon.ico', mimetype='image/vnd.microsoft.icon')


# @cache.cached(timeout=3600)
@app.route('/')
def index():
    if current_user.is_authenticated():