mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
call LOG.error on obsolete endpoints: /alias/new and /alias/random/new
This commit is contained in:
parent
f37a155c1f
commit
7f6267cc4a
2 changed files with 12 additions and 1 deletions
|
@ -12,6 +12,7 @@ from app.models import ApiKey, AliasUsedOn, GenEmail, User, DeletedAlias
|
||||||
from app.utils import random_string
|
from app.utils import random_string
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: obsolete
|
||||||
@api_bp.route("/alias/new", methods=["GET", "POST"])
|
@api_bp.route("/alias/new", methods=["GET", "POST"])
|
||||||
@cross_origin()
|
@cross_origin()
|
||||||
def index():
|
def index():
|
||||||
|
@ -19,6 +20,8 @@ def index():
|
||||||
the incoming request must provide a valid api-key in "Authentication" header and
|
the incoming request must provide a valid api-key in "Authentication" header and
|
||||||
the payload must contain "hostname"
|
the payload must contain "hostname"
|
||||||
"""
|
"""
|
||||||
|
LOG.error("/api/alias/new is obsolete!")
|
||||||
|
|
||||||
api_code = request.headers.get("Authentication")
|
api_code = request.headers.get("Authentication")
|
||||||
api_key = ApiKey.get_by(code=api_code)
|
api_key = ApiKey.get_by(code=api_code)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from app.log import LOG
|
||||||
from app.models import GenEmail, AliasUsedOn
|
from app.models import GenEmail, AliasUsedOn
|
||||||
|
|
||||||
|
|
||||||
|
# OBSOLETE
|
||||||
@api_bp.route("/alias/random/new", methods=["POST"])
|
@api_bp.route("/alias/random/new", methods=["POST"])
|
||||||
@cross_origin()
|
@cross_origin()
|
||||||
@verify_api_key
|
@verify_api_key
|
||||||
|
@ -21,10 +22,17 @@ def new_random_alias():
|
||||||
409 if alias already exists
|
409 if alias already exists
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
LOG.error("/api/alias/new is obsolete! Called by %s", g.user)
|
||||||
|
|
||||||
user = g.user
|
user = g.user
|
||||||
if not user.can_create_new_random_alias():
|
if not user.can_create_new_random_alias():
|
||||||
LOG.d("user %s cannot create random alias", user)
|
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")
|
hostname = request.args.get("hostname")
|
||||||
gen_email = GenEmail.create_new_gen_email(user_id=user.id)
|
gen_email = GenEmail.create_new_gen_email(user_id=user.id)
|
||||||
|
|
Loading…
Reference in a new issue