mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 15:07:35 +01:00
Enable email notifications on claim login
This commit is contained in:
parent
7a4335b8bc
commit
c44cc8082c
@ -24,7 +24,7 @@ from wtforms.validators import *
|
|||||||
|
|
||||||
from app.models import *
|
from app.models import *
|
||||||
from app.tasks.emails import send_verify_email, send_anon_email, send_unsubscribe_verify, send_user_email
|
from app.tasks.emails import send_verify_email, send_anon_email, send_unsubscribe_verify, send_user_email
|
||||||
from app.utils import randomString, make_flask_login_password, is_safe_url, check_password_hash, addAuditLog
|
from app.utils import randomString, make_flask_login_password, is_safe_url, check_password_hash, addAuditLog, nonEmptyOrNone
|
||||||
from passlib.pwd import genphrase
|
from passlib.pwd import genphrase
|
||||||
|
|
||||||
from . import bp
|
from . import bp
|
||||||
@ -228,8 +228,8 @@ def handle_set_password(form):
|
|||||||
current_user.password = make_flask_login_password(form.password.data)
|
current_user.password = make_flask_login_password(form.password.data)
|
||||||
|
|
||||||
if hasattr(form, "email"):
|
if hasattr(form, "email"):
|
||||||
newEmail = form.email.data
|
newEmail = nonEmptyOrNone(form.email.data)
|
||||||
if newEmail != current_user.email and newEmail.strip() != "":
|
if newEmail and newEmail != current_user.email:
|
||||||
if EmailSubscription.query.filter_by(email=form.email.data, blacklisted=True).count() > 0:
|
if EmailSubscription.query.filter_by(email=form.email.data, blacklisted=True).count() > 0:
|
||||||
flash("That email address has been unsubscribed/blacklisted, and cannot be used", "danger")
|
flash("That email address has been unsubscribed/blacklisted, and cannot be used", "danger")
|
||||||
return
|
return
|
||||||
|
@ -152,6 +152,7 @@ def make_flask_login_password(plaintext):
|
|||||||
def login_user_set_active(user: User, *args, **kwargs):
|
def login_user_set_active(user: User, *args, **kwargs):
|
||||||
if user.rank == UserRank.NOT_JOINED and user.email is None:
|
if user.rank == UserRank.NOT_JOINED and user.email is None:
|
||||||
user.rank = UserRank.MEMBER
|
user.rank = UserRank.MEMBER
|
||||||
|
user.notification_preferences = UserNotificationPreferences(user)
|
||||||
user.is_active = True
|
user.is_active = True
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user