mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 03:37:28 +01:00
Add list of pending email verifications to modtools
This commit is contained in:
parent
04878fc9e0
commit
8f453a8cdf
@ -286,9 +286,7 @@ def verify_email():
|
|||||||
flash(gettext("Unknown verification token!"), "danger")
|
flash(gettext("Unknown verification token!"), "danger")
|
||||||
return redirect(url_for("homepage.home"))
|
return redirect(url_for("homepage.home"))
|
||||||
|
|
||||||
delta = (datetime.datetime.now() - ver.created_at)
|
if ver.is_expired:
|
||||||
delta: datetime.timedelta
|
|
||||||
if delta.total_seconds() > 12*60*60:
|
|
||||||
flash(gettext("Token has expired"), "danger")
|
flash(gettext("Token has expired"), "danger")
|
||||||
db.session.delete(ver)
|
db.session.delete(ver)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
@ -371,6 +371,12 @@ class UserEmailVerification(db.Model):
|
|||||||
is_password_reset = db.Column(db.Boolean, nullable=False, default=False)
|
is_password_reset = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_expired(self):
|
||||||
|
delta = (datetime.datetime.now() - self.created_at)
|
||||||
|
delta: datetime.timedelta
|
||||||
|
return delta.total_seconds() > 12 * 60 * 60
|
||||||
|
|
||||||
|
|
||||||
class EmailSubscription(db.Model):
|
class EmailSubscription(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
@ -112,4 +112,17 @@
|
|||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<h3>{{ _("Pending email verifications") }}</h3>
|
||||||
|
<ul>
|
||||||
|
{% for ver in user.email_verifications %}
|
||||||
|
{% if not ver.is_expired %}
|
||||||
|
<li>
|
||||||
|
{{ ver.email }}, {{ ver.created_at | datetime }}:
|
||||||
|
<a href="{{ url_for('users.verify_email', token=ver.token) }}">verify</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user