diff --git a/app/api/views/new_custom_alias.py b/app/api/views/new_custom_alias.py index 7f0c8f22..28e27ce2 100644 --- a/app/api/views/new_custom_alias.py +++ b/app/api/views/new_custom_alias.py @@ -37,7 +37,7 @@ def new_custom_alias(): alias_prefix = data["alias_prefix"] alias_suffix = data["alias_suffix"] - # make sure alias_prefix is more than 3 chars + # make sure alias_prefix is not empty alias_prefix = alias_prefix.strip() alias_prefix = convert_to_id(alias_prefix) if not alias_prefix: # should be checked on frontend diff --git a/app/dashboard/templates/dashboard/alias_log.html b/app/dashboard/templates/dashboard/alias_log.html index 0e349076..938877e0 100644 --- a/app/dashboard/templates/dashboard/alias_log.html +++ b/app/dashboard/templates/dashboard/alias_log.html @@ -39,7 +39,7 @@ {% endfor %} - + {% endblock %} {% block script %} diff --git a/app/dashboard/templates/dashboard/custom_alias.html b/app/dashboard/templates/dashboard/custom_alias.html index 753536ae..f1c30b4c 100644 --- a/app/dashboard/templates/dashboard/custom_alias.html +++ b/app/dashboard/templates/dashboard/custom_alias.html @@ -18,16 +18,17 @@
- + - You can use letter, number or dash. Alias must have at least 3 characters + You can use letter, number or dash. Alias prefix cannot be empty.
- +
@@ -35,10 +36,12 @@ .{{ email_suffix }}@{{ EMAIL_DOMAIN }}
+ +
+ +
- - {% if custom_domains %} diff --git a/app/dashboard/views/custom_alias.py b/app/dashboard/views/custom_alias.py index d1272bbc..b04d34db 100644 --- a/app/dashboard/views/custom_alias.py +++ b/app/dashboard/views/custom_alias.py @@ -28,8 +28,8 @@ def custom_alias(): email_prefix = convert_to_id(email_prefix) email_suffix = request.form.get("email-suffix") - if len(email_prefix) < 3: - error = "email must be at least 3 letters" + if not email_prefix: + error = "alias prefix cannot be empty" else: full_email = f"{email_prefix}.{email_suffix}@{EMAIL_DOMAIN}" # check if email already exists