def register(): form = UserInfoForm() if request.method == 'POST' and form.validate(): # Get Information username = form.username.data password = form.password.data email = form.email.data print("\n", username, password, email) # Create an instance of User user = User(username, email, password) # Open and insert into database db.session.add(user) # Save info into database db.session.commit() # Flask Email Sender NEEDS API TO WORK msg = Message(f'Thanks for Signing Up! {username}', recipients=[email]) msg.body = ('Congrats on signing up! Looking forward to your posts!') msg.html = ('<h1> Welcome to debug_project_app!</h1>' '<p> This will be fun! </p>') print(msg) mail.send(msg) return redirect(url_for('home')) return render_template('register.html', form=form)
def register(): form = UserInfoForm() if request.method = 'POST' and form.validate(): # Get Information username = form.username.data password = form.password.data email = form.email print("\n",username,password,email) # Create an instance of User user = User(username,email,password) # Open and insert into database db.session.add(user) # Save info into database db.session.commit()