From b8093aefa3fd67204fab35b58e9372a722c7794d Mon Sep 17 00:00:00 2001 From: Son NK Date: Sat, 21 Mar 2020 11:11:52 +0100 Subject: [PATCH] Handle invalid email when user signs up --- app/auth/views/register.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/auth/views/register.py b/app/auth/views/register.py index 97ffefce..aaf53b6b 100644 --- a/app/auth/views/register.py +++ b/app/auth/views/register.py @@ -46,7 +46,11 @@ def register(): user = User.create(email=email, name="", password=form.password.data) db.session.commit() - send_activation_email(user, next_url) + try: + send_activation_email(user, next_url) + except: + flash("Invalid email, are you sure the email is correct?", "error") + return redirect(url_for("auth.register")) return render_template("auth/register_waiting_activation.html")