use "default" hostname if hostname is too short

This commit is contained in:
Son NK 2019-12-03 10:43:20 +00:00
parent c012d3686a
commit 6764a4b582
1 changed files with 5 additions and 5 deletions

View File

@ -31,6 +31,11 @@ def index():
hostname = data.get("hostname")
# avoid too short custom email prefix
if len(hostname) < 3:
LOG.d("hostname %s too short", hostname)
hostname = "default"
# Update api key stats
api_key.last_used = arrow.now()
api_key.times += 1
@ -54,11 +59,6 @@ def index():
if user.is_premium():
LOG.d("create new custom alias %s %s", hostname, user)
# avoid too short custom email prefix
if len(hostname) < 3:
LOG.d("hostname %s too short", hostname)
hostname = "default"
# generate a custom email
found = False
while not found: