diff --git a/capsulflask/auth.py b/capsulflask/auth.py index b8177d9..a2b7572 100644 --- a/capsulflask/auth.py +++ b/capsulflask/auth.py @@ -1,4 +1,5 @@ import functools +import re from flask import Blueprint from flask import flash @@ -36,6 +37,9 @@ def login(): if not email: 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: token = get_model().login(email) diff --git a/capsulflask/static/style.css b/capsulflask/static/style.css index 536c73f..00cffeb 100644 --- a/capsulflask/static/style.css +++ b/capsulflask/static/style.css @@ -1,4 +1,10 @@ .float-right { display: inline-block; float: right; +} + +.flash { + background: red; + font-weight: bold; + text-align: center; } \ No newline at end of file