def register(): """Register new user.""" form = RegisterForm(request.form) if form.validate_on_submit(): User.create(username=form.username.data, email=form.email.data, password=form.password.data, 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): """Check password.""" user = User.create(username='******', email='*****@*****.**', password='******') assert user.check_password('foobarbaz123') is True assert user.check_password('barfoobaz') is False
def test_check_password(self): """Check password.""" user = User.create(username="******", email="*****@*****.**", password="******") assert user.check_password("foobarbaz123") is True assert user.check_password("barfoobaz") is False
def create_user(n, e, p): User.create( username=n, email=e, password_hash=generate_password_hash(p), )