mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 14:32:25 +01:00
Enable email notifications for new users
This commit is contained in:
parent
9c10e190bc
commit
683b855584
@ -110,6 +110,7 @@ def register():
|
|||||||
"We were unable to create the account as the email is already in use by {}. Try a different email address.".format(user.display_name))
|
"We were unable to create the account as the email is already in use by {}. Try a different email address.".format(user.display_name))
|
||||||
else:
|
else:
|
||||||
user = User(form.username.data, False, form.email.data, make_flask_login_password(form.password.data))
|
user = User(form.username.data, False, form.email.data, make_flask_login_password(form.password.data))
|
||||||
|
user.notification_preferences = UserNotificationPreferences(user)
|
||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
|
|
||||||
addAuditLog(AuditSeverity.USER, user, "Registered",
|
addAuditLog(AuditSeverity.USER, user, "Registered",
|
||||||
@ -267,18 +268,23 @@ def verify_email():
|
|||||||
flash("Unknown verification token!", "danger")
|
flash("Unknown verification token!", "danger")
|
||||||
return redirect(url_for("homepage.home"))
|
return redirect(url_for("homepage.home"))
|
||||||
|
|
||||||
addAuditLog(AuditSeverity.USER, ver.user, "Confirmed their email",
|
user = ver.user
|
||||||
url_for("users.profile", username=ver.user.username))
|
|
||||||
|
addAuditLog(AuditSeverity.USER, user, "Confirmed their email",
|
||||||
|
url_for("users.profile", username=user.username))
|
||||||
|
|
||||||
|
was_activating = not user.is_active
|
||||||
|
|
||||||
|
user.is_active = True
|
||||||
|
user.notification_preferences = user.notification_preferences or UserNotificationPreferences(user)
|
||||||
|
user.email = ver.email
|
||||||
|
|
||||||
was_activating = not ver.user.is_active
|
|
||||||
ver.user.is_active = True
|
|
||||||
ver.user.email = ver.email
|
|
||||||
db.session.delete(ver)
|
db.session.delete(ver)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
if ver.is_password_reset:
|
if ver.is_password_reset:
|
||||||
login_user(ver.user)
|
login_user(user)
|
||||||
ver.user.password = None
|
user.password = None
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return redirect(url_for("users.set_password"))
|
return redirect(url_for("users.set_password"))
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Your email is needed to recover your account if you forget your
|
Your email is needed to recover your account if you forget your
|
||||||
password, and to optionally send notifications.
|
password and to send (configurable) notifications.
|
||||||
Your email will never be shared to a third-party.
|
Your email will never be shared with a third-party.
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Your email is needed to recover your account if you forget your
|
Your email is needed to recover your account if you forget your
|
||||||
password, and to optionally send notifications.
|
password, and to send (configurable) notifications.
|
||||||
Your email will never be shared to a third-party.
|
Your email will never be shared with a third-party.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user