From d9c211d8da4a1ebc9e789f4fdda28498023e31dd Mon Sep 17 00:00:00 2001 From: Son NK Date: Sat, 7 Dec 2019 19:04:27 +0100 Subject: [PATCH] fix api create new custom alias --- app/api/views/new_custom_alias.py | 4 ++-- app/api/views/new_random_alias.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/views/new_custom_alias.py b/app/api/views/new_custom_alias.py index 28e27ce2..8b30a0e9 100644 --- a/app/api/views/new_custom_alias.py +++ b/app/api/views/new_custom_alias.py @@ -28,7 +28,7 @@ def new_custom_alias(): user = g.user if not user.can_create_new_custom_alias(): LOG.d("user %s cannot create custom alias", user) - return jsonify(error="no more quota for custom alias"), 400 + return jsonify(error="You have created 3 custom aliases, please upgrade to create more"), 400 user_custom_domains = [cd.domain for cd in user.verified_custom_domains()] hostname = request.args.get("hostname") @@ -69,7 +69,7 @@ def new_custom_alias(): LOG.d("full alias already used %s", full_alias) return jsonify(error=f"alias {full_alias} already exists"), 409 - gen_email = GenEmail.create(user_id=user.id, email=full_alias) + gen_email = GenEmail.create(user_id=user.id, email=full_alias, custom=True) db.session.commit() if hostname: diff --git a/app/api/views/new_random_alias.py b/app/api/views/new_random_alias.py index 19864150..0fa45a91 100644 --- a/app/api/views/new_random_alias.py +++ b/app/api/views/new_random_alias.py @@ -24,7 +24,7 @@ def new_random_alias(): user = g.user if not user.can_create_new_random_alias(): LOG.d("user %s cannot create random alias", user) - return jsonify(error="no more quota for random alias"), 400 + return jsonify(error="You have created 3 random aliases, please upgrade to create more"), 400 hostname = request.args.get("hostname") gen_email = GenEmail.create_new_gen_email(user_id=user.id)