From 9e486fc2c02b981d97f675a1ee6f2fd525083ee6 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Wed, 17 Feb 2021 12:56:28 +0100 Subject: [PATCH] add alias transfer --- app/config.py | 3 + app/dashboard/__init__.py | 1 + .../dashboard/alias_transfer_receive.html | 46 ++++++ .../dashboard/alias_transfer_send.html | 43 ++++++ app/dashboard/templates/dashboard/index.html | 18 ++- app/dashboard/views/alias_transfer.py | 140 ++++++++++++++++++ tests/dashboard/test_alias_transfer.py | 41 +++++ 7 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 app/dashboard/templates/dashboard/alias_transfer_receive.html create mode 100644 app/dashboard/templates/dashboard/alias_transfer_send.html create mode 100644 app/dashboard/views/alias_transfer.py create mode 100644 tests/dashboard/test_alias_transfer.py diff --git a/app/config.py b/app/config.py index 731a923a..67d44418 100644 --- a/app/config.py +++ b/app/config.py @@ -171,6 +171,9 @@ FLASK_SECRET = os.environ["FLASK_SECRET"] SESSION_COOKIE_NAME = "slapp" MAILBOX_SECRET = FLASK_SECRET + "mailbox" CUSTOM_ALIAS_SECRET = FLASK_SECRET + "custom_alias" +ALIAS_TRANSFER_SECRET = os.environ.get("ALIAS_TRANSFER_SECRET") or ( + FLASK_SECRET + "alias_transfer" +) # AWS AWS_REGION = os.environ.get("AWS_REGION") or "eu-west-3" diff --git a/app/dashboard/__init__.py b/app/dashboard/__init__.py index 8363aa5d..3852ef88 100644 --- a/app/dashboard/__init__.py +++ b/app/dashboard/__init__.py @@ -25,4 +25,5 @@ from .views import ( contact_detail, setup_done, batch_import, + alias_transfer, ) diff --git a/app/dashboard/templates/dashboard/alias_transfer_receive.html b/app/dashboard/templates/dashboard/alias_transfer_receive.html new file mode 100644 index 00000000..9a6d6c6a --- /dev/null +++ b/app/dashboard/templates/dashboard/alias_transfer_receive.html @@ -0,0 +1,46 @@ +{% extends 'default.html' %} + +{% set active_page = "dashboard" %} + +{% block title %} + Receive {{ alias.email }} +{% endblock %} + +{% block default_content %} +
+ You are invited to become the owner of the alias {{ alias.email }} +
+ ++ Please choose the mailbox(es) that owns this alias 👇 +
+ + + + ++ This page allows you to transfer {{ alias.email }} to another person so they can use it to receive and send + emails. +
+ ++ In order to transfer ownership, + please send the following URL 👇 to the other person. +
+ + + {{ alias_transfer_url }} + + ++ This person can then confirm the reception and become the owner of the alias. +
+