create capsul and capsuls list page working
This commit is contained in:
@ -33,17 +33,17 @@ def account_required(view):
|
||||
def login():
|
||||
if request.method == "POST":
|
||||
email = request.form["email"]
|
||||
error = None
|
||||
errors = list()
|
||||
|
||||
if not email:
|
||||
error = "email is required"
|
||||
errors.append("email is required")
|
||||
elif len(email.strip()) < 6 or email.count('@') != 1 or email.count('.') == 0:
|
||||
error = "enter a valid email address"
|
||||
errors.append("enter a valid email address")
|
||||
|
||||
if error is None:
|
||||
if len(errors) == 0:
|
||||
token = get_model().login(email)
|
||||
if token is None:
|
||||
error = "too many logins. please use one of the existing login links that have been emailed to you"
|
||||
errors.append("too many logins. please use one of the existing login links that have been emailed to you")
|
||||
else:
|
||||
link = f"{current_app.config['BASE_URL']}/auth/magic/{token}"
|
||||
|
||||
@ -65,7 +65,8 @@ def login():
|
||||
|
||||
return render_template("login-landing.html", email=email)
|
||||
|
||||
flash(error)
|
||||
for error in errors:
|
||||
flash(error)
|
||||
|
||||
return render_template("login.html")
|
||||
|
||||
|
Reference in New Issue
Block a user