Browse Source

improve custom alias check

Son NK 5 years ago
parent
commit
539bf56e97
1 changed files with 3 additions and 2 deletions
  1. 3 2
      app/dashboard/views/custom_alias.py

+ 3 - 2
app/dashboard/views/custom_alias.py

@@ -72,10 +72,11 @@ def custom_alias():
 
 def verify_prefix_suffix(user, alias_prefix, alias_suffix, user_custom_domains) -> bool:
     """verify if user could create an alias with the given prefix and suffix"""
+    if not alias_prefix or not alias_suffix:  # should be caught on frontend
+        return False
+
     alias_prefix = alias_prefix.strip()
     alias_prefix = convert_to_id(alias_prefix)
-    if not alias_prefix:  # should be caught on frontend
-        return False
 
     # make sure alias_suffix is either .random_word@simplelogin.co or @my-domain.com
     alias_suffix = alias_suffix.strip()