1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-11-23 22:04:47 +02:00

Ratelimit outgoing emails per user

This commit is contained in:
Florent Daigniere
2021-08-08 09:21:14 +02:00
parent 6b0e8a0dfb
commit 1438253a06
9 changed files with 36 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.inspection import inspect
from werkzeug.utils import cached_property
from mailu import dkim
from mailu import dkim, utils
db = flask_sqlalchemy.SQLAlchemy()
@@ -501,6 +501,12 @@ class User(Base, Email):
self.reply_enddate > now
)
@property
def sender_limiter(self):
return utils.limiter.get_limiter(
app.config["MESSAGE_RATELIMIT"], "sender", self.email
)
@classmethod
def get_password_context(cls):
""" create password context for hashing and verification