Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Pass email status from allauth to template

Roland Geiderdd0fe2b5baf2
diff --git a/wger/core/templates/user/preferences.html b/wger/core/templates/user/preferences.html
index fea172542..64c936e4b 100644
--- a/wger/core/templates/user/preferences.html
+++ b/wger/core/templates/user/preferences.html
@@ -13,7 +13,7 @@
{% block sidebar %}
- {% if user.userprofile.email_verified %}
+ {% if email_verified %}
<p>
<span class="{% fa_class 'envelope-circle-check' %} text-success"></span>
{% translate "Verified email" %}
@@ -41,10 +41,10 @@
{% block options %}
<div class="btn-group">
<div class="btn-group" role="group">
- <button type="button"
+ <button type="button"
class="btn btn-primary btn-sm dropdown-toggle"
data-bs-toggle="dropdown"
- aria-haspopup="true"
+ aria-haspopup="true"
aria-expanded="false">
<span class="{% fa_class 'cog' %}"></span>
{% translate "Options" %}
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 38a2120b4..d124af9bd 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -301,6 +301,8 @@ def preferences(request):
context.update(csrf(request))
redirect = False
+ email_obj = EmailAddress.objects.get_for_user(request.user, request.user.email)
+
# Process the preferences form
if request.method == 'POST':
form = UserPreferencesForm(data=request.POST, instance=request.user.userprofile)
@@ -338,6 +340,7 @@ def preferences(request):
redirect = False
context['form'] = form
+ context['email_verified'] = email_obj.verified
if redirect:
messages.success(request, _('Settings successfully updated'))