Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

If the user updated his email, reset the email verified flag

Roland Geideree6e8cedc98f
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 2afc549da..d625afb87 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -322,9 +322,18 @@ def preferences(request):
# Process the email form
if request.method == 'POST':
+ user_email = request.user.email
email_form = UserPersonalInformationForm(data=request.POST, instance=request.user)
if email_form.is_valid() and redirect:
+
+ # If the user changes the email, it is no longer verified
+ if user_email != email_form.instance.email:
+ logger.debug('resetting verified flag')
+ request.user.userprofile.email_verified = False
+ request.user.userprofile.save()
+
+ # Save as normal
email_form.save()
redirect = True
else: