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":