Skip to content

Instantly share code, notes, and snippets.

@robertjdominguez
Last active June 4, 2018 22:06
Show Gist options
  • Save robertjdominguez/93881a922b20d6314b6a900d47f8beb5 to your computer and use it in GitHub Desktop.
Save robertjdominguez/93881a922b20d6314b6a900d47f8beb5 to your computer and use it in GitHub Desktop.
Not going to give you every bit you need, but follow the pattern.
@app.route('/register', methods=['GET', 'POST'])
def register():
form = RegistrationForm(request.form)
if request.method == 'POST' and form.validate():
first_name = form.first_name.data
last_name = form.last_name.data
email = form.email.data
username = form.username.data
password = sha256_crypt.encrypt(str(form.password.data))
# Add user
new_user = Users(first_name = form.first_name.data,last_name = form.last_name.data)
db.session.add(new_user)
# Commit to DB
db.session.commit()
flash('Registered successfully!', 'success')
return redirect(url_for('login'))
return render_template('register.html', form=form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment