From 6764a4b582842d992da0a5ce4a3fdf6b697b0f29 Mon Sep 17 00:00:00 2001 From: Son NK Date: Tue, 3 Dec 2019 10:43:20 +0000 Subject: [PATCH] use "default" hostname if hostname is too short --- app/api/views/index.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/views/index.py b/app/api/views/index.py index 853f6552..2c17c647 100644 --- a/app/api/views/index.py +++ b/app/api/views/index.py @@ -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: