2020-05-24 16:14:48 +02:00
|
|
|
from flask_limiter import Limiter
|
|
|
|
from flask_limiter.util import get_remote_address
|
2019-07-01 17:18:12 +02:00
|
|
|
from flask_login import LoginManager
|
|
|
|
|
|
|
|
login_manager = LoginManager()
|
2020-05-09 14:13:37 +02:00
|
|
|
login_manager.session_protection = "strong"
|
2020-05-24 16:14:48 +02:00
|
|
|
|
|
|
|
# Setup rate limit facility
|
|
|
|
limiter = Limiter(key_func=get_remote_address)
|
|
|
|
|
|
|
|
|
2021-03-24 16:26:42 +01:00
|
|
|
# @limiter.request_filter
|
|
|
|
# def ip_whitelist():
|
|
|
|
# # Uncomment line to test rate limit in dev environment
|
|
|
|
# # return False
|
|
|
|
# # No limit for local development
|
|
|
|
# return request.remote_addr == "127.0.0.1"
|