예제 #1
0
def join_presale():
    full_name = request.form['full_name']
    email = request.form['email']
    desired_allocation = request.form["desired_allocation"]
    desired_allocation_currency = request.form["desired_allocation_currency"]
    citizenship = request.form["citizenship"]
    sending_addr = request.form["sending_addr"]
    ip_addr = get_real_ip()
    if not full_name:
        return jsonify(success=False,
                       message=gettext("Please enter your name"))
    if not email:
        return jsonify(success=False,
                       message=gettext("Please enter your email"))
    if not citizenship:
        return jsonify(success=False,
                       message=gettext("Select your country of citizenship"))
    if not desired_allocation:
        return jsonify(success=False,
                       message=gettext("Please enter your desired allocation"))
    if not desired_allocation_currency:
        return jsonify(success=False, message=gettext("Select a currency"))
    if not recaptcha.verify():
        return jsonify(success=False,
                       message=gettext("Please prove you are not a robot."))
    feedback = mailing_list.presale(full_name, email, desired_allocation,
                                    desired_allocation_currency, citizenship,
                                    sending_addr, request.remote_addr)
    mailing_list.add_sendgrid_contact(email, full_name, citizenship)
    insight.add_contact(sending_addr,
                        name=full_name,
                        email=email,
                        presale_interest=1)
    flash(feedback)
    return jsonify(success=True, message=gettext("OK"))
예제 #2
0
def join_presale():
    full_name = request.form['full_name']
    email = request.form['email']
    accredited = request.form["accredited"]
    entity_type = request.form["entity_type"]
    desired_allocation = request.form["desired_allocation"]
    desired_allocation_currency = request.form["desired_allocation_currency"]
    citizenship = request.form["citizenship"]
    sending_addr = request.form["sending_addr"]
    note = request.form["note"]
    ip_addr = get_real_ip()
    print("CHECK:", email,
          request.remote_addr)  # Temp until we get IP recorded
    if not full_name:
        return jsonify(gettext("Please enter your name"))
    if not email:
        return jsonify(gettext("Please enter your email"))
    if not accredited or not entity_type or not citizenship or not desired_allocation_currency:
        return jsonify(gettext("An error occured"))
    if not desired_allocation:
        return jsonify(gettext("Please enter your desired allocation"))
    if "confirm" not in request.form:
        return jsonify(gettext("Please agree to the important notice"))
    if not recaptcha.verify():
        return jsonify(gettext("Please prove you are not a robot."))
    feedback = mailing_list.presale(full_name, email, accredited, entity_type,
                                    desired_allocation,
                                    desired_allocation_currency, citizenship,
                                    sending_addr, note, request.remote_addr)
    flash(feedback)
    return jsonify("OK")