def register(): form = RegisterForm() if form.validate_on_submit(): account = Account(form.email.data, form.name.data, form.password.data) db.session.add(account) db.session.commit() flash('Account has been registered, please log in.') return redirect(url_for(".login")) return render_template('register.html', form=form)
def test_password_setter(): account = Account("*****@*****.**", "Jane", 'cat') assert account.password_hash is not None
def test_empty_password(): account = Account("*****@*****.**", "Jane", None) assert account.verify_password('cat') == False
def test_password_salts_are_random(): account1 = Account("*****@*****.**", "Jane", 'cat') account2 = Account("*****@*****.**", "John", 'cat') assert account1.password_hash != account2.password_hash
def test_password_verification(): account = Account("*****@*****.**", "Jane", 'cat') assert account.verify_password('cat') assert account.verify_password('dog') == False
def test_no_password_getter(): account = Account("*****@*****.**", "Jane", 'cat') account.password