当前位置: 首页>>代码示例>>Python>>正文


Python Users2.verify_pass方法代码示例

本文整理汇总了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"
                            ""))
开发者ID:tkanesh,项目名称:oasisqe,代码行数:43,代码来源:__init__.py


注:本文中的oasis.lib.Users2.verify_pass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。