def get_approver_emails():
    """Get's the approver emails for a domain and returns an API response"""
    domain = request.args.get("domain", "")
    try:
        emails = _get_approver_emails(domain)
        return jsonify(status="SUCCESS", data=emails)
    except:
        msg = "An error occured whilst trying to retrieve the " + "verification emails for %s" % domain
        return jsonify(status="ERROR", msg=msg)
def verify_csr():
    csr = request.args.get("csr", "")
    if csr == "":
        return jsonify(status="ERROR", msg="You haven't entered anything")
    try:
        result = check_csr(csr)
        if result["isWildcardCSR"]:
            return jsonify(status="ERROR", msg="This CSR is for a wildcard certificate")
        if "DominName" in result:
            domain = result["DominName"]
        else:
            domain = result["DomainName"]
        emails = _get_approver_emails(domain)
        data = {"emails": emails, "domain": domain}
        return jsonify(status="SUCCESS", data=data)
    except:
        logging.exception("Uncaught CSR Error")
        msg = "This isn't a valid CSR. If you are sure it is " + "then contact support."
        return jsonify(status="ERROR", msg=msg)
Beispiel #3
0
def verify_csr():
    csr = request.args.get("csr", '')
    if csr == '':
        return jsonify(status='ERROR', msg="You haven't entered anything")
    try:
        result = check_csr(csr)
        if result['isWildcardCSR']:
            return jsonify(
                status='ERROR',
                msg="This CSR is for a wildcard certificate"
            )
        if 'DominName' in result:
            domain = result['DominName']
        else:
            domain = result['DomainName']
        emails = _get_approver_emails(domain)
        data = {'emails': emails, 'domain': domain}
        return jsonify(status='SUCCESS', data=data)
    except:
        logging.exception("Uncaught CSR Error")
        msg = "This isn't a valid CSR. If you are sure it is " + \
              "then contact support."
        return jsonify(status='ERROR', msg=msg)