From 7f6267cc4a7022c80a09f59a5e524f459292033c Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 8 Dec 2019 16:36:35 +0100 Subject: [PATCH] call LOG.error on obsolete endpoints: /alias/new and /alias/random/new --- app/api/views/index.py | 3 +++ app/api/views/new_random_alias.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/api/views/index.py b/app/api/views/index.py index 2c17c647..afaa0de4 100644 --- a/app/api/views/index.py +++ b/app/api/views/index.py @@ -12,6 +12,7 @@ from app.models import ApiKey, AliasUsedOn, GenEmail, User, DeletedAlias from app.utils import random_string +# TODO: obsolete @api_bp.route("/alias/new", methods=["GET", "POST"]) @cross_origin() def index(): @@ -19,6 +20,8 @@ def index(): the incoming request must provide a valid api-key in "Authentication" header and the payload must contain "hostname" """ + LOG.error("/api/alias/new is obsolete!") + api_code = request.headers.get("Authentication") api_key = ApiKey.get_by(code=api_code) diff --git a/app/api/views/new_random_alias.py b/app/api/views/new_random_alias.py index 0fa45a91..b02b37cd 100644 --- a/app/api/views/new_random_alias.py +++ b/app/api/views/new_random_alias.py @@ -8,6 +8,7 @@ from app.log import LOG from app.models import GenEmail, AliasUsedOn +# OBSOLETE @api_bp.route("/alias/random/new", methods=["POST"]) @cross_origin() @verify_api_key @@ -21,10 +22,17 @@ def new_random_alias(): 409 if alias already exists """ + LOG.error("/api/alias/new is obsolete! Called by %s", g.user) + user = g.user if not user.can_create_new_random_alias(): LOG.d("user %s cannot create random alias", user) - return jsonify(error="You have created 3 random aliases, please upgrade to create more"), 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)