瀏覽代碼

Handle invalid email when user signs up

Son NK 5 年之前
父節點
當前提交
b8093aefa3
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      app/auth/views/register.py

+ 5 - 1
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")