4.42.2
This commit is contained in:
parent
78184eeae4
commit
24ba25ab6a
@ -308,28 +308,29 @@ def delete_alias(alias: Alias, user: User):
|
|||||||
Delete an alias and add it to either global or domain trash
|
Delete an alias and add it to either global or domain trash
|
||||||
Should be used instead of Alias.delete, DomainDeletedAlias.create, DeletedAlias.create
|
Should be used instead of Alias.delete, DomainDeletedAlias.create, DeletedAlias.create
|
||||||
"""
|
"""
|
||||||
# save deleted alias to either global or domain trash
|
LOG.i(f"User {user} has deleted alias {alias}")
|
||||||
|
# save deleted alias to either global or domain tra
|
||||||
if alias.custom_domain_id:
|
if alias.custom_domain_id:
|
||||||
if not DomainDeletedAlias.get_by(
|
if not DomainDeletedAlias.get_by(
|
||||||
email=alias.email, domain_id=alias.custom_domain_id
|
email=alias.email, domain_id=alias.custom_domain_id
|
||||||
):
|
):
|
||||||
LOG.d("add %s to domain %s trash", alias, alias.custom_domain_id)
|
domain_deleted_alias = DomainDeletedAlias(
|
||||||
Session.add(
|
user_id=user.id,
|
||||||
DomainDeletedAlias(
|
email=alias.email,
|
||||||
user_id=user.id,
|
domain_id=alias.custom_domain_id,
|
||||||
email=alias.email,
|
|
||||||
domain_id=alias.custom_domain_id,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
Session.add(domain_deleted_alias)
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
LOG.i(
|
||||||
|
f"Moving {alias} to domain {alias.custom_domain_id} trash {domain_deleted_alias}"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if not DeletedAlias.get_by(email=alias.email):
|
if not DeletedAlias.get_by(email=alias.email):
|
||||||
LOG.d("add %s to global trash", alias)
|
deleted_alias = DeletedAlias(email=alias.email)
|
||||||
Session.add(DeletedAlias(email=alias.email))
|
Session.add(deleted_alias)
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
LOG.i(f"Moving {alias} to global trash {deleted_alias}")
|
||||||
|
|
||||||
LOG.i("delete alias %s", alias)
|
|
||||||
Alias.filter(Alias.id == alias.id).delete()
|
Alias.filter(Alias.id == alias.id).delete()
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from app.models import PartnerUser, SocialAuth
|
|||||||
from app.proton.utils import get_proton_partner
|
from app.proton.utils import get_proton_partner
|
||||||
from app.utils import sanitize_next_url
|
from app.utils import sanitize_next_url
|
||||||
|
|
||||||
_SUDO_GAP = 900
|
_SUDO_GAP = 120
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(FlaskForm):
|
class LoginForm(FlaskForm):
|
||||||
|
@ -141,7 +141,7 @@ def index():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if request.form.get("form-name") == "delete-alias":
|
if request.form.get("form-name") == "delete-alias":
|
||||||
LOG.d("delete alias %s", alias)
|
LOG.i(f"User {current_user} requested deletion of alias {alias}")
|
||||||
email = alias.email
|
email = alias.email
|
||||||
alias_utils.delete_alias(alias, current_user)
|
alias_utils.delete_alias(alias, current_user)
|
||||||
flash(f"Alias {email} has been deleted", "success")
|
flash(f"Alias {email} has been deleted", "success")
|
||||||
|
@ -30,7 +30,9 @@ def check_bucket_limit(
|
|||||||
try:
|
try:
|
||||||
value = lock_redis.incr(bucket_lock_name, bucket_seconds)
|
value = lock_redis.incr(bucket_lock_name, bucket_seconds)
|
||||||
if value > max_hits:
|
if value > max_hits:
|
||||||
LOG.i(f"Rate limit hit for {bucket_lock_name} -> {value}/{max_hits}")
|
LOG.i(
|
||||||
|
f"Rate limit hit for {lock_name} (bucket id {bucket_id}) -> {value}/{max_hits}"
|
||||||
|
)
|
||||||
newrelic.agent.record_custom_event(
|
newrelic.agent.record_custom_event(
|
||||||
"BucketRateLimit",
|
"BucketRateLimit",
|
||||||
{"lock_name": lock_name, "bucket_seconds": bucket_seconds},
|
{"lock_name": lock_name, "bucket_seconds": bucket_seconds},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user