forked from 3wordchant/capsul-flask
validate email address
This commit is contained in:
parent
3406ff3358
commit
e6fcb847f0
@ -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)
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
.float-right {
|
.float-right {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
float: right;
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flash {
|
||||||
|
background: red;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user