Wrong password feedback and no need to expose password requirements at login
This commit is contained in:
parent
6486d4b0a0
commit
b4b9b7ed58
@ -18,6 +18,6 @@ class LoginForm(FlaskForm):
|
|||||||
validators=[validators.InputRequired(), Email(), Length(6, 64)],
|
validators=[validators.InputRequired(), Email(), Length(6, 64)],
|
||||||
)
|
)
|
||||||
password = PasswordField(
|
password = PasswordField(
|
||||||
"Password:", validators=[validators.InputRequired(), Length(12, 72)]
|
"Password:", validators=[validators.InputRequired()]
|
||||||
)
|
)
|
||||||
submit = SubmitField("Sign In")
|
submit = SubmitField("Sign In")
|
||||||
|
@ -81,6 +81,8 @@ def login():
|
|||||||
return redirect(next or url_for("index"))
|
return redirect(next or url_for("index"))
|
||||||
else:
|
else:
|
||||||
flash("Invalid Username or password!", "danger")
|
flash("Invalid Username or password!", "danger")
|
||||||
|
loginform.password.errors.append("Invalid email or password!")
|
||||||
|
return render_template("login.html", loginform=loginform)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
flash(e, "danger")
|
flash(e, "danger")
|
||||||
return render_template("login.html", loginform=loginform)
|
return render_template("login.html", loginform=loginform)
|
||||||
|
Loading…
Reference in New Issue
Block a user