mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 21:27:10 +01:00
notify admin when user creates new custom domain or custom alias associated with custom domain
This commit is contained in:
parent
0234af03d3
commit
3f189163dd
@ -3,6 +3,7 @@ from flask_login import login_required, current_user
|
|||||||
|
|
||||||
from app.config import EMAIL_DOMAIN, HIGHLIGHT_GEN_EMAIL_ID
|
from app.config import EMAIL_DOMAIN, HIGHLIGHT_GEN_EMAIL_ID
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
|
from app.email_utils import notify_admin
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.log import LOG
|
from app.log import LOG
|
||||||
from app.models import GenEmail, DeletedAlias, CustomDomain
|
from app.models import GenEmail, DeletedAlias, CustomDomain
|
||||||
@ -86,6 +87,10 @@ def custom_alias():
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash(f"Alias {full_email} has been created", "success")
|
flash(f"Alias {full_email} has been created", "success")
|
||||||
|
|
||||||
|
notify_admin(
|
||||||
|
f"User {current_user.email} creates new alias for domain {custom_domain.domain}"
|
||||||
|
)
|
||||||
|
|
||||||
session[HIGHLIGHT_GEN_EMAIL_ID] = gen_email.id
|
session[HIGHLIGHT_GEN_EMAIL_ID] = gen_email.id
|
||||||
return redirect(url_for("dashboard.index"))
|
return redirect(url_for("dashboard.index"))
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from wtforms import StringField, validators
|
|||||||
from app.config import EMAIL_SERVERS_WITH_PRIORITY, EMAIL_SERVERS
|
from app.config import EMAIL_SERVERS_WITH_PRIORITY, EMAIL_SERVERS
|
||||||
from app.dashboard.base import dashboard_bp
|
from app.dashboard.base import dashboard_bp
|
||||||
from app.dns_utils import get_mx_domains
|
from app.dns_utils import get_mx_domains
|
||||||
|
from app.email_utils import notify_admin
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models import CustomDomain
|
from app.models import CustomDomain
|
||||||
|
|
||||||
@ -54,6 +55,9 @@ def custom_domain():
|
|||||||
f"New domain {new_custom_domain.domain} has been created successfully",
|
f"New domain {new_custom_domain.domain} has been created successfully",
|
||||||
"success",
|
"success",
|
||||||
)
|
)
|
||||||
|
notify_admin(
|
||||||
|
f"User {current_user.email} creates new domain {new_custom_domain.domain}"
|
||||||
|
)
|
||||||
return redirect(url_for("dashboard.custom_domain"))
|
return redirect(url_for("dashboard.custom_domain"))
|
||||||
elif request.form.get("form-name") == "check-domain":
|
elif request.form.get("form-name") == "check-domain":
|
||||||
custom_domain_id = request.form.get("custom-domain-id")
|
custom_domain_id = request.form.get("custom-domain-id")
|
||||||
|
Loading…
Reference in New Issue
Block a user