本文整理汇总了Python中oasis.lib.Users2.verify_pass方法的典型用法代码示例。如果您正苦于以下问题:Python Users2.verify_pass方法的具体用法?Python Users2.verify_pass怎么用?Python Users2.verify_pass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.Users2
的用法示例。
在下文中一共展示了Users2.verify_pass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login_local_submit
# 需要导入模块: from oasis.lib import Users2 [as 别名]
# 或者: from oasis.lib.Users2 import verify_pass [as 别名]
def login_local_submit():
""" They've entered some credentials on the local login screen.
Check them, then set up the session or redirect back with an error.
"""
if 'username' not in request.form or 'password' not in request.form:
L.info("Failed Login")
flash("Incorrect name or password.")
return redirect(url_for("login_local"))
username = sanitize_username(request.form['username'])
password = request.form['password']
user_id = Users2.verify_pass(username, password)
if not user_id:
L.info("Failed Login for %s" % username)
flash("Incorrect name or password.")
return redirect(url_for("login_local"))
user = Users2.get_user(user_id)
if not user['confirmed']:
flash("""Your account is not yet confirmed. You should have received
an email with instructions in it to do so.""")
return redirect(url_for("login_local"))
session['username'] = username
session['user_id'] = user_id
session['user_givenname'] = user['givenname']
session['user_familyname'] = user['familyname']
session['user_fullname'] = user['fullname']
session['user_authtype'] = "local"
audit(1, user_id, user_id, "UserAuth",
"%s successfully logged in locally" % (session['username'],))
if 'redirect' in session:
L.info("Following redirect for %s" % username)
target = OaConfig.parentURL + session['redirect']
del session['redirect']
return redirect(target)
L.info("Successful Login for %s" % username)
return redirect(url_for("main_top"
""))