示例#1
0
文件: app.py 项目: pgagnon/progcom
def login_post():
    uid = l.check_pw(request.values.get('email'), request.values.get('pw'))
    if not uid:
        flash('Bad email or password.')
        return redirect(url_for('login'))
    user = l.get_user(uid)
    if not user.approved:
        flash('You have not yet been approved.')
        return redirect(url_for('login'))
    session['userid'] = uid
    return redirect('/')
示例#2
0
文件: app.py 项目: aldeka/progcom
def login_post():
    uid = l.check_pw(request.values.get("email"), request.values.get("pw"))
    if not uid:
        flash("Bad email or password.")
        return redirect(url_for("login"))
    user = l.get_user(uid)
    if not user.approved:
        flash("You have not yet been approved.")
        return redirect(url_for("login"))
    session["userid"] = uid
    return redirect("/")
示例#3
0
文件: app.py 项目: rmoorman/progcom
def login_post():
    uid = l.check_pw(request.values.get('email'),
                        request.values.get('pw'))
    if not uid:
        flash('Bad email or password.')
        return redirect(url_for('login'))
    user = l.get_user(uid)
    if not user.approved:
        flash('You have not yet been approved.')
        return redirect(url_for('login'))
    session['userid'] = uid
    return redirect('/')
示例#4
0
def test_user_basics():
    for n in range(20):
        assert l.add_user(u'{}@example.com'.format(n), u'Name {}'.format(n),
                          u'pw{}'.format(n))

    email = u'*****@*****.**'
    name = u'Ned Jackson Lovely'
    pw = u'password'

    assert not l.check_pw(email, pw)

    uid = l.add_user(email, name, pw)

    assert len(l.list_users()) == 21

    for user in l.list_users():
        assert not user.approved_on

    l.approve_user(uid)

    for user in l.list_users():
        assert not user.approved_on if user.id != uid else user.approved_on

    assert l.get_user(uid).display_name == name

    assert l.check_pw(email, pw)
    assert l.check_pw(email.upper(), pw)
    assert not l.check_pw(email, pw.upper())

    pw2 = u'\u2603'
    l.change_pw(uid, pw2)

    assert not l.check_pw(email, pw)
    assert l.check_pw(email, pw2)
示例#5
0
def test_user_basics():
    for n in range(20):
        assert l.add_user(u"{}@example.com".format(n), u"Name {}".format(n), u"pw{}".format(n))

    email = u"*****@*****.**"
    name = u"Ned Jackson Lovely"
    pw = u"password"

    assert not l.check_pw(email, pw)

    uid = l.add_user(email, name, pw)

    assert len(l.list_users()) == 21

    for user in l.list_users():
        assert not user.approved_on

    l.approve_user(uid)

    for user in l.list_users():
        assert not user.approved_on if user.id != uid else user.approved_on

    assert l.get_user(uid).display_name == name

    assert l.check_pw(email, pw)
    assert l.check_pw(email.upper(), pw)
    assert not l.check_pw(email, pw.upper())

    pw2 = u"\u2603"
    l.change_pw(uid, pw2)

    assert not l.check_pw(email, pw)
    assert l.check_pw(email, pw2)