def register(): form = RegisterForm(request.form, csrf_enabled=False) if form.validate_on_submit(): User.create(username=form.username.data, email=form.email.data, first_name=form.first_name.data, last_name=form.last_name.data, corps=form.corps.data, password=form.password.data, carrier=form.carrier.data, phone_num=form.phone_num.data, phone_active=True, active=True) flash("Thank you for registering. You can now log in.", 'success') return redirect(url_for('public.home')) else: flash_errors(form) return render_template('public/register.html', form=form)
def test_check_password(self): user = User.create(username="******", email="*****@*****.**", password="******") assert user.check_password('foobarbaz123') is True assert user.check_password("barfoobaz") is False