This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User { | |
id: ID! | |
username: String! | |
email: String! | |
profile: Profile | |
settings: Settings | |
} | |
type Profile { | |
id: ID! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="fas fa-envelope" href="mailto:?subject=Trade like a pro&body=This is neat!%0A%0AGet Mega Duper App.%0A%0APlease sign up with my link: {{ url }}%26channel=email"></a> | |
<a class="fab fa-facebook-f" href="https://www.facebook.com/sharer.php?u={{ url }}%26channel=facebook" | |
data-share-url="https://www.facebook.com/sharer.php?u={{ url }}%26channel=facebook" onclick="javascript:window.open(this.getAttribute('data-share-url'), '_blank', 'width=800,height=500');return false;"></a> | |
<a class="fab fa-facebook-messenger" href="fb-messenger://share/?link={{ url }}%26channel=fb_messenger" | |
data-share-url="fb-messenger://share/?link={{ url }}%26channel=fb_messenger" onclick="javascript:window.open(this.getAttribute('data-share-url'), '_blank', 'width=800,height=500');return false;"></a> | |
<a class="fab fa-whatsapp" href="whatsapp://send?text=Get+Mega+Duper+App%3A+{{ url }}%26channel=whatsapp" | |
data-share-url="whatsapp://send?text=Get+Mega+Duper+App%3A+{{ url }}%26channel=whatsapp" | |
onclick="javascript:window.open |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
{% set title="Your page title goes here"%} | |
{% set description="Some description if you wish."%} | |
<!-- Social sharing tags --> | |
<meta property="og:title" content="{{ title }}"> | |
<meta property="og:description" content="{{ description }}"> | |
<meta property="og:image" content="{{ url_for('static', filename='img/social-sharing-thumbnail.png', _external=True) }}"> | |
<meta property="og:url" content="{{ url_for('main.index', _external=True) }}"> | |
<meta name="twitter:card" content="summary_large_image"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "base.html" %} | |
{% block content %} | |
<div class="container"> | |
<div class="row justify-content-center pt-2"> | |
{% if referring_uuid %} | |
<form action="{{ url_for('main.index') + '?user=' + referring_uuid }}" method="post" class="form-inline"> | |
{% else %} | |
<form action="{{ url_for('main.index') }}" method="post" class="form-inline"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmailForm(FlaskForm): | |
email = EmailField('Email', validators=[DataRequired(), Email()]) | |
submit = SubmitField('Get early access') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_email(email): | |
''' | |
Reduces an email address to its canonical form: | |
- strips white space | |
- transforms to lowercase | |
- removes the +tag part in the name | |
- removes dots if a google domain | |
''' | |
email = email.strip().lower() | |
name, domain = email.rsplit('@', 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
referrals = db.Table( | |
'referral', | |
db.Column('referring', db.String(8), db.ForeignKey('waitlist.uuid')), | |
db.Column('referred', db.String(8), db.ForeignKey('waitlist.uuid')), | |
db.PrimaryKeyConstraint('referring', 'referred', name='referrals_pk') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def verify_email(token): | |
payload = utils.decode_jwt_token(token) | |
user = get_user(payload['user_id']) | |
if user is None: | |
return | |
if not user.email_confirmed: | |
user.email_confirmed = True | |
now = datetime.now(timezone.utc) | |
user.email_confirmed_on = now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_waitlist_position(uuid): | |
waitlist_user = get_waitlist_user(uuid) | |
score = waitlist_user.score | |
users_ahead = Waitlist.query.filter(Waitlist.score <= score).count() | |
return max(score, users_ahead) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Waitlist(BaseModel, db.Model): | |
__tablename__ = 'waitlist' | |
initial_score = 65231 | |
decrease_per_referral = 10 | |
uuid = db.Column(db.String(8), primary_key=True) | |
user_id = db.Column(db.Integer, db.ForeignKey('user.id')) | |
user = db.relationship('User', back_populates='waitlist') | |
score = db.Column(db.Integer) |
NewerOlder