本文整理匯總了Python中pyload.webui.PYLOAD.checkAuth方法的典型用法代碼示例。如果您正苦於以下問題:Python PYLOAD.checkAuth方法的具體用法?Python PYLOAD.checkAuth怎麽用?Python PYLOAD.checkAuth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyload.webui.PYLOAD
的用法示例。
在下文中一共展示了PYLOAD.checkAuth方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: login_post
# 需要導入模塊: from pyload.webui import PYLOAD [as 別名]
# 或者: from pyload.webui.PYLOAD import checkAuth [as 別名]
def login_post():
user = request.forms.get("username")
password = request.forms.get("password")
info = PYLOAD.checkAuth(user, password)
if not info:
return render_to_response("login.html", {"errors": True}, [pre_processor])
set_session(request, info)
return redirect("/")
示例2: login
# 需要導入模塊: from pyload.webui import PYLOAD [as 別名]
# 或者: from pyload.webui.PYLOAD import checkAuth [as 別名]
def login():
response.headers.replace("Content-type", "application/json")
response.headers.append("Cache-Control", "no-cache, must-revalidate")
user = request.forms.get("username")
password = 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)