def registerError(request): if request.method == 'POST': form = RegistrationForm(request.POST) if form.is_valid(): form.save() return redirect('/forum') else: form = RegistrationForm() return render(request, 'forum/reg_error.html')
def register(): form = RegistrationForm() if form.validate_on_submit(): hashed_password = bcrypt.generate_password_hash(form.password.data).decode('utf-8') user = User(email=form.email.data, password=hashed_password) db.session.add(user) db.session.commit() message = 'Good Day! <p> Welcome to Pi Forum!</p>' send_email('Greetings, New User!', '*****@*****.**', [form.email.data], message, message) flash(f'Account created for {form.email.data}!', 'success') return redirect(url_for('login')) return render_template('register.html', title='Register', form=form)
def register(): form = RegistrationForm() return render_template('register.html', form=form)