validate email address

This commit is contained in:
forest 2020-05-09 23:45:20 -05:00
parent 3406ff3358
commit e6fcb847f0
2 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import functools import functools
import re
from flask import Blueprint from flask import Blueprint
from flask import flash from flask import flash
@ -36,6 +37,9 @@ def login():
if not email: if not email:
error = "Email is required." error = "Email is required."
elif not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email):
error = "Enter a valid email address."
if error is None: if error is None:
token = get_model().login(email) token = get_model().login(email)

View File

@ -2,3 +2,9 @@
display: inline-block; display: inline-block;
float: right; float: right;
} }
.flash {
background: red;
font-weight: bold;
text-align: center;
}