mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
inform user when his alias has been transferred
This commit is contained in:
parent
3494f314bc
commit
475eaa2bc0
3 changed files with 43 additions and 0 deletions
|
@ -5,6 +5,7 @@ from itsdangerous import Signer
|
|||
from app.config import ALIAS_TRANSFER_SECRET
|
||||
from app.config import URL
|
||||
from app.dashboard.base import dashboard_bp
|
||||
from app.email_utils import send_email, render
|
||||
from app.extensions import db
|
||||
from app.log import LOG
|
||||
from app.models import (
|
||||
|
@ -48,6 +49,21 @@ def transfer(alias, new_user, new_mailboxes: [Mailbox]):
|
|||
if not alias.original_owner_id:
|
||||
alias.original_owner_id = alias.user_id
|
||||
|
||||
# inform previous owner
|
||||
old_user = alias.user
|
||||
send_email(
|
||||
old_user.email,
|
||||
f"Alias {alias.email} has been received",
|
||||
render(
|
||||
"transactional/alias-transferred.txt",
|
||||
alias=alias,
|
||||
),
|
||||
render(
|
||||
"transactional/alias-transferred.html",
|
||||
alias=alias,
|
||||
),
|
||||
)
|
||||
|
||||
# now the alias belongs to the new user
|
||||
alias.user_id = new_user.id
|
||||
|
||||
|
|
21
templates/emails/transactional/alias-transferred.html
Normal file
21
templates/emails/transactional/alias-transferred.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% call text() %}
|
||||
<h1>
|
||||
{{ alias.email }} has been transferred.
|
||||
</h1>
|
||||
{% endcall %}
|
||||
|
||||
{% call text() %}
|
||||
Your (previously) alias {{ alias.email }} has been received by another user.
|
||||
{% endcall %}
|
||||
|
||||
{% call text() %}
|
||||
Best, <br/>
|
||||
SimpleLogin Team.
|
||||
{% endcall %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
6
templates/emails/transactional/alias-transferred.txt
Normal file
6
templates/emails/transactional/alias-transferred.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
{{ alias.email }} has been transferred.
|
||||
|
||||
Your (previously) alias {{ alias.email }} has been received by another user.
|
||||
|
||||
Best,
|
||||
SimpleLogin Team.
|
Loading…
Reference in a new issue