You've already forked Mailu
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user