Send registration emails #11
1 changed files with 12 additions and 1 deletions
|
@ -4,8 +4,9 @@ import flask_login
|
|||
from flask_login import current_user
|
||||
from goathacks.registration.forms import LoginForm, RegisterForm
|
||||
from werkzeug.security import check_password_hash, generate_password_hash
|
||||
from flask_mail import Message
|
||||
|
||||
from goathacks import db
|
||||
from goathacks import db, mail as app_mail
|
||||
from goathacks.models import User
|
||||
|
||||
bp = Blueprint('registration', __name__, url_prefix="/registration")
|
||||
|
@ -55,6 +56,16 @@ def register():
|
|||
db.session.commit()
|
||||
flask_login.login_user(user)
|
||||
|
||||
if waitlisted:
|
||||
msg = Message("Goathacks - Waitlist Confirmation")
|
||||
else:
|
||||
msg = Message("GoatHacks - Registration Confirmation")
|
||||
|
||||
msg.add_recipient(user.email)
|
||||
msg.sender = ("GoatHacks Team", "hack@wpi.edu")
|
||||
msg.body = render_template("emails/registration.txt", user=user)
|
||||
app_mail.send(msg)
|
||||
|
||||
return redirect(url_for("dashboard.home"))
|
||||
else:
|
||||
flash("Passwords do not match")
|
||||
|
|
Loading…
Add table
Reference in a new issue