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"))
def join_mailing_list(): if 'email' in request.form: email = request.form['email'] # optional fields first_name = request.form[ 'first_name'] if 'first_name' in request.form else None last_name = request.form[ 'last_name'] if 'last_name' in request.form else None full_name = ' '.join(filter(None, (first_name, last_name))) full_name = None if full_name == '' else full_name phone = request.form['phone'] if 'phone' in request.form else None dapp_user = 1 if 'dapp_user' in request.form else 0 if 'eth_address' in request.form: insight.add_contact(address=request.form['eth_address'], dapp_user=1, name=full_name, email=email, phone=phone) ip_addr = get_real_ip() feedback = mailing_list.send_welcome(email, ip_addr) mailing_list.add_sendgrid_contact(email=email, full_name=full_name, dapp_user=dapp_user) return jsonify(feedback) else: return jsonify("Missing email")
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) 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("OK")
def join_mailing_list(): if not 'email' in request.form: return jsonify(success=False, message=gettext("Missing email")) email = request.form['email'] if not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email): return jsonify(success=False, message=gettext("Invalid email")) # optional fields eth_address = request.form.get('eth_address') or None first_name = request.form.get('first_name') or None last_name = request.form.get('last_name') or None full_name = request.form.get('name') or None if not full_name and (first_name or last_name): full_name = ' '.join(filter(None, (first_name, last_name))) phone = request.form.get('phone') or None ip_addr = request.form.get('ip_addr') or get_real_ip() country_code = request.form.get('country_code') or get_country(ip_addr) dapp_user = 1 if 'dapp_user' in request.form else 0 investor = 1 if 'investor' in request.form else 0 backfill = request.form.get( 'backfill' ) or None # Indicates the request was made from an internal backfill script. new_user = False log('Updating mailing list for', email, eth_address) try: # Add an entry to the eth_contact DB table. if eth_address: log('Adding to wallet insights') insight.add_contact(address=eth_address, dapp_user=dapp_user, investor=investor, name=full_name, email=email, phone=phone, country_code=country_code) # Add an entry to the email_list table. log('Adding to mailing list') new_contact = mailing_list.add_contact(email, first_name, last_name, ip_addr, country_code) # If it is a new contact and not a backfill, send a welcome email. if new_contact and not backfill: log('Sending welcome email') mailing_list.send_welcome(email) # Add the entry to the Sendgrid contact list. if new_contact: new_user = True log('Adding to Sendgrid contact list') mailing_list.add_sendgrid_contact(email=email, full_name=full_name, country_code=country_code, dapp_user=dapp_user) except Exception as err: log('Failure: %s' % err) return jsonify(success=False, message=str(err)) if not new_user: return jsonify(success=True, message=gettext('You\'re already registered!')) return jsonify(success=True, message=gettext('Thanks for signing up!'))
def join_mailing_list(): if not "email" in request.form: return jsonify(success=False, message=gettext("Missing email")) email = request.form["email"] if not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email): return jsonify(success=False, message=gettext("Invalid email")) # optional fields source = request.form.get("source") or None eth_address = request.form.get("eth_address") or None first_name = request.form.get("first_name") or None last_name = request.form.get("last_name") or None full_name = request.form.get("name") or None if not full_name and (first_name or last_name): full_name = " ".join(filter(None, (first_name, last_name))) phone = request.form.get("phone") or None ip_addr = request.form.get("ip_addr") or get_real_ip() country_code = request.form.get("country_code") or get_country(ip_addr) dapp_user = 1 if "dapp_user" in request.form else 0 investor = 1 if "investor" in request.form else 0 backfill = ( request.form.get("backfill") or None ) # Indicates the request was made from an internal backfill script. new_user = False log("Updating mailing list for", email, eth_address) try: # Add an entry to the eth_contact DB table. if eth_address: log("Adding to wallet insights") insight.add_contact( address=eth_address, dapp_user=dapp_user, investor=investor, name=full_name, email=email, phone=phone, country_code=country_code, ) # Add an entry to the email_list table. log("Adding to mailing list") new_contact = mailing_list.add_contact(email, first_name, last_name, ip_addr, country_code) # If it is a new contact and not a backfill, send a welcome email. if new_contact and not backfill: log("Sending welcome email") mailing_list.send_welcome(email, source) # Add the entry to the Sendgrid contact list. if new_contact: new_user = True log("Adding to Sendgrid contact list") mailing_list.add_sendgrid_contact( email=email, full_name=full_name, country_code=country_code, dapp_user=dapp_user, ) except Exception as err: log("Failure: %s" % err) return jsonify(success=False, message=str(err)) if not new_user: return jsonify(success=True, message=gettext("You're already registered!")) return jsonify(success=True, message=gettext("Thanks for signing up!"))