Last active
June 4, 2018 22:06
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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