From 8e7f5e56d66f51bb727bf6acee7a64cf4c7ba998 Mon Sep 17 00:00:00 2001 From: Son NK Date: Wed, 22 Jan 2020 14:04:38 +0100 Subject: [PATCH] add "your domain" to user's owned domain --- app/dashboard/templates/dashboard/custom_alias.html | 10 +++++++--- app/dashboard/views/custom_alias.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/dashboard/templates/dashboard/custom_alias.html b/app/dashboard/templates/dashboard/custom_alias.html index 36e3e380..4bab5151 100644 --- a/app/dashboard/templates/dashboard/custom_alias.html +++ b/app/dashboard/templates/dashboard/custom_alias.html @@ -36,13 +36,17 @@ {% if suffixes|length > 1 %} {% else %} - {{ suffixes[0] }} + {{ suffixes[0][1] }} {% endif %} diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index ebae7e8a..6996ded7 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -25,16 +25,17 @@ def custom_alias(): return redirect(url_for("dashboard.index")) user_custom_domains = [cd.domain for cd in current_user.verified_custom_domains()] + # List of (is_custom_domain, alias-suffix) suffixes = [] # put custom domain first for alias_domain in user_custom_domains: - suffixes.append("@" + alias_domain) + suffixes.append((True, "@" + alias_domain)) # then default domain for domain in ALIAS_DOMAINS: suffixes.append( - ("" if DISABLE_ALIAS_SUFFIX else "." + random_word()) + "@" + domain + (False, ("" if DISABLE_ALIAS_SUFFIX else "." + random_word()) + "@" + domain) ) if request.method == "POST":