allow cross_origin for /api/alias/new

This commit is contained in:
Son NK 2019-11-28 23:19:12 +00:00
parent 786d640511
commit fd7f819803

View file

@ -2,6 +2,7 @@ import random
import arrow import arrow
from flask import jsonify, request from flask import jsonify, request
from flask_cors import cross_origin
from app.api.base import api_bp from app.api.base import api_bp
from app.config import EMAIL_DOMAIN from app.config import EMAIL_DOMAIN
@ -12,6 +13,7 @@ from app.utils import random_string
@api_bp.route("/alias/new", methods=["GET", "POST"]) @api_bp.route("/alias/new", methods=["GET", "POST"])
@cross_origin()
def index(): 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
@ -61,7 +63,7 @@ def index():
# check if email already exists. Very rare that an email is already used # check if email already exists. Very rare that an email is already used
if GenEmail.get_by(email=full_email) or DeletedAlias.get_by( if GenEmail.get_by(email=full_email) or DeletedAlias.get_by(
email=full_email email=full_email
): ):
LOG.warning("full_email already used %s. Retry", full_email) LOG.warning("full_email already used %s. Retry", full_email)
else: else: