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)
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)
def reset_password_post(): l.change_pw(request.user.id, request.values.get('pw')) flash('Password changed') return redirect('/')