1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-24 11:57:40 +00:00

Make it possible to disable ratelimiter

Update APScheduler
Error message on missing flask-limiter
This commit is contained in:
Ozzie Isaacs
2023-02-05 13:43:35 +01:00
parent 4b7a0f3662
commit fb42f6bfff
8 changed files with 51 additions and 126 deletions

View File

@@ -1315,17 +1315,17 @@ def login():
@limiter.limit("40/day", key_func=lambda: request.form.get('username', "").strip().lower())
@limiter.limit("3/minute", key_func=lambda: request.form.get('username', "").strip().lower())
def login_post():
form = request.form.to_dict()
try:
limiter.check()
except RateLimitExceeded:
flash(_(u"Wait one minute"), category="error")
return render_login()
flash(_(u"Please wait one minute before next login"), category="error")
return render_login(form.get("username", ""), form.get("password", ""))
if current_user is not None and current_user.is_authenticated:
return redirect(url_for('web.index'))
if config.config_login_type == constants.LOGIN_LDAP and not services.ldap:
log.error(u"Cannot activate LDAP authentication")
flash(_(u"Cannot activate LDAP authentication"), category="error")
form = request.form.to_dict()
user = ub.session.query(ub.User).filter(func.lower(ub.User.name) == form.get('username', "").strip().lower()) \
.first()
remember_me = bool(form.get('remember_me'))