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('/')
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("/")
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)