Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Better handling of temporary users

Roland Geider7c97c24933b1
diff --git a/wger/core/templates/navigation.html b/wger/core/templates/navigation.html
index 3c6a1ca20..bfcd8c6c4 100644
--- a/wger/core/templates/navigation.html
+++ b/wger/core/templates/navigation.html
@@ -292,6 +292,16 @@
{% translate "Reset password" %}
</a>
</li>
+ {% if user.userprofile.is_temporary %}
+ <li class="dropdown-divider"></li>
+ <li>
+ <a class="dropdown-item"
+ href="{% url 'core:user:logout' %}">
+ <span class="{% fa_class 'sign-out-alt' %}"></span>
+ {% translate "Logout" %}
+ </a>
+ </li>
+ {% endif %}
</ul>
</li>
</ul>
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 251ebe012..69b8f60ee 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -660,9 +660,8 @@ class WgerLoginView(LoginView):
"""
def dispatch(self, request, *args, **kwargs):
- next_url = request.GET.get('next', reverse('core:dashboard'))
- if request.user.is_authenticated:
- return redirect(next_url)
+ if request.user.is_authenticated and not request.user.userprofile.is_temporary:
+ return redirect(request.GET.get('next', reverse('core:dashboard')))
# Proceed with the normal login page logic
return super().dispatch(request, *args, **kwargs)