rename is_activated to email_verified
parent
37ae68d13b
commit
144d7a31be
|
@ -98,7 +98,7 @@ class User(Base):
|
|||
chud = Column(Integer, default=0)
|
||||
queen = Column(Integer, default=0)
|
||||
chud_phrase = Column(String)
|
||||
is_activated = Column(Boolean, default=False)
|
||||
email_verified = Column(Boolean, default=False)
|
||||
shadowbanned = Column(Integer, ForeignKey("users.id"))
|
||||
chudded_by = Column(Integer, ForeignKey("users.id"))
|
||||
over_18 = Column(Boolean, default=False)
|
||||
|
|
|
@ -101,7 +101,7 @@ def stats():
|
|||
"users": "{:,}".format(g.db.query(User).count()),
|
||||
"private users": "{:,}".format(g.db.query(User).filter_by(is_private=True).count()),
|
||||
"banned users": "{:,}".format(g.db.query(User).filter(User.is_banned != None).count()),
|
||||
"verified email users": "{:,}".format(g.db.query(User).filter_by(is_activated=True).count()),
|
||||
"verified email users": "{:,}".format(g.db.query(User).filter_by(email_verified=True).count()),
|
||||
"coins in circulation": "{:,}".format(g.db.query(func.sum(User.coins)).scalar()),
|
||||
"total shop sales": "{:,}".format(g.db.query(func.sum(User.coins_spent)).scalar()),
|
||||
"signups last 24h": "{:,}".format(g.db.query(User).filter(User.created_utc > day).count()),
|
||||
|
|
|
@ -16,7 +16,7 @@ from files.__main__ import app, limiter
|
|||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def verify_email(v):
|
||||
if v.is_activated:
|
||||
if v.email_verified:
|
||||
abort(400, "Email already verified!")
|
||||
|
||||
send_verification_email(v)
|
||||
|
@ -45,11 +45,11 @@ def activate(v):
|
|||
if not validate_hash(f"{email}+{id}+{timestamp}", token):
|
||||
abort(403)
|
||||
|
||||
if user.is_activated and user.email == email:
|
||||
if user.email_verified and user.email == email:
|
||||
abort(400, "Email already verified!")
|
||||
|
||||
user.email = email
|
||||
user.is_activated = True
|
||||
user.email_verified = True
|
||||
claim_rewards_all_users()
|
||||
|
||||
badge_grant(user=user, badge_id=2)
|
||||
|
|
|
@ -1358,8 +1358,8 @@ def fp(v, fp):
|
|||
|
||||
v.fp = fp
|
||||
users = g.db.query(User).filter(User.fp == fp, User.id != v.id).all()
|
||||
if v.email and v.is_activated:
|
||||
alts = g.db.query(User).filter(User.email == v.email, User.is_activated, User.id != v.id).all()
|
||||
if v.email and v.email_verified:
|
||||
alts = g.db.query(User).filter(User.email == v.email, User.email_verified, User.id != v.id).all()
|
||||
if alts:
|
||||
users += alts
|
||||
for u in users:
|
||||
|
@ -1495,7 +1495,7 @@ def gumroad():
|
|||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
def settings_claim_rewards(v):
|
||||
if not (v.email and v.is_activated):
|
||||
if not (v.email and v.email_verified):
|
||||
abort(400, f"You must have a verified email to verify {patron} status and claim your rewards!")
|
||||
|
||||
transactions = g.db.query(Transaction).filter_by(email=v.email, claimed=None).all()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<label for="new-email" class="w-lg-25">Email</label>
|
||||
<div class="w-lg-100">
|
||||
<input autocomplete="off" class="form-control" id="new_email" {% if v.email %}placeholder="{{v.email}}"{% else %}placeholder="Your email"{% endif %} type="email" pattern='{{EMAIL_REGEX_PATTERN}}' name="new_email" required>
|
||||
{% if v.email and not v.is_activated %}
|
||||
{% if v.email and not v.email_verified %}
|
||||
<div class="text-danger mt-1" id="email-verify-text">Email not verified. You will not be able to recover your account with this email until you verify it. <u><button type="button" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/verify_email');emailVerifyText()" class="text-primary font-weight-bold ml-1">Verify now.</button></u></div>
|
||||
{% elif not v.email %}
|
||||
<div class="text-danger mt-1" id="email-verify-text">Add an email to secure your account in case you forget your password.</div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
alter table users rename column is_activated to email_verified;
|
|
@ -109,7 +109,7 @@ CREATE TABLE public.users (
|
|||
created_utc integer NOT NULL,
|
||||
admin_level integer DEFAULT 0 NOT NULL,
|
||||
over_18 boolean DEFAULT false NOT NULL,
|
||||
is_activated boolean DEFAULT false NOT NULL,
|
||||
email_verified boolean DEFAULT false NOT NULL,
|
||||
bio character varying(5000),
|
||||
bio_html character varying(20000),
|
||||
referred_by integer,
|
||||
|
@ -3074,4 +3074,3 @@ ALTER TABLE ONLY public.comments
|
|||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
INSERT INTO public.users (
|
||||
username, passhash, created_utc, admin_level, over_18, is_activated,
|
||||
username, passhash, created_utc, admin_level, over_18, email_verified,
|
||||
original_username, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor, theme, themecolor,
|
||||
reddit, pronouns, verified, profileurl, highres,
|
||||
marsify, last_viewed_post_notifs, last_viewed_log_notifs, last_viewed_reddit_notifs
|
||||
|
|
Loading…
Reference in New Issue