예제 #1
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)
예제 #2
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)
예제 #3
0
파일: app.py 프로젝트: pgagnon/progcom
def reset_password_post():
    l.change_pw(request.user.id, request.values.get('pw'))
    flash('Password changed')
    return redirect('/')
예제 #4
0
파일: app.py 프로젝트: rmoorman/progcom
def reset_password_post():
    l.change_pw(request.user.id, request.values.get('pw'))
    flash('Password changed')
    return redirect('/')