Ejemplo n.º 1
0
def index():
    if session_util.is_login():
        return redirect(url_for('v2ray.index'))
    from init import common_context
    return render_template('index.html',
                           login_title=config.get_login_title(),
                           **common_context)
Ejemplo n.º 2
0
def before():
    from base.models import Msg
    if not session_util.is_login():
        for bp in need_login_bps:
            if request.path.startswith(bp.url_prefix):
                if is_ajax():
                    return jsonify(Msg(False, gettext('You has been logout, please refresh this page and login again')))
                else:
                    return redirect(url_for('base.index'))
Ejemplo n.º 3
0
def before():
    from base.models import Msg
    if not session_util.is_login():
        for bp in need_login_bps:
            if request.path.startswith(bp.url_prefix):
                if is_ajax():
                    return jsonify(Msg(False, '你的登录时效已过,请刷新页面重新登录'))
                else:
                    return redirect(url_for('base.index'))
Ejemplo n.º 4
0
def before():
    from base.models import Msg

    if not session_util.is_login():
        for bp in need_login_bps:
            if request.path.startswith(bp.url_prefix):
                if request.headers.get("X-Requested-With") == "XMLHttpRequest":
                    return jsonify(
                        Msg(
                            False,
                            gettext(
                                "You has been logout, please refresh this page and login again."
                            ),
                        ))
                else:
                    return redirect(url_for("base.index"))