예제 #1
0
파일: app.py 프로젝트: Burnout5151/pyload
def login_post():
    user = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    info = PYLOAD.checkAuth(user, password)

    if not info:
        return render_to_response("login.html", {"errors": True}, [pre_processor])

    set_session(info)
    return bottle.redirect("/")
예제 #2
0
def login_post():
    user = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    info = PYLOAD.checkAuth(user, password)

    if not info:
        return render_to_response("login.html", {"errors": True},
                                  [pre_processor])

    set_session(info)
    return bottle.redirect("/")
예제 #3
0
def login():
    bottle.response.headers.replace("Content-type", "application/json")
    bottle.response.headers.append("Cache-Control", "no-cache, must-revalidate")

    user = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    info = PYLOAD.checkAuth(user, password)

    if not info:
        return json_dumps(False)

    s = set_session(request, info)

    # get the session id by dirty way, documentations seems wrong
    try:
        sid = s._headers['cookie_out'].split("=")[1].split(";")[0]
        return json_dumps(sid)
    except Exception:
        return json_dumps(True)
예제 #4
0
파일: api.py 프로젝트: toroettg/pyload
def login():
    bottle.response.headers.replace("Content-type", "application/json")
    bottle.response.headers.append("Cache-Control", "no-cache, must-revalidate")

    user = bottle.request.forms.get("username")
    password = bottle.request.forms.get("password")

    info = PYLOAD.checkAuth(user, password)

    if not info:
        return json_dumps(False)

    s = set_session(request, info)

    # get the session id by dirty way, documentations seems wrong
    try:
        sid = s._headers["cookie_out"].split("=")[1].split(";")[0]
        return json_dumps(sid)
    except Exception:
        return json_dumps(True)