Skip to content

Commit

Permalink
LOGIN_URL everywhere; fixes #44
Browse files Browse the repository at this point in the history
Fixes remaining issue to fix #44
  • Loading branch information
nitely committed Sep 19, 2020
1 parent d226b76 commit da0b4bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion spirit/core/templates/spirit/_header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load spirit_tags i18n %}
{% load_settings 'LOGIN_URL' %}

<header class="layout__header js-tabs-container">
<div class="header__logo_wrapper">
Expand Down Expand Up @@ -76,7 +77,7 @@
</div>
{% else %}
<a class="header__login"
href="{% url "spirit:user:auth:login" %}?next={% firstof request.get_full_path|urlencode '/' %}"
href="{% url st_settings.LOGIN_URL %}?next={% firstof request.get_full_path|urlencode '/' %}"
>{% trans "Log in" %}</a>
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
{% extends "spirit/_base.html" %}

{% load i18n %}
{% load_settings 'LOGIN_URL' %}

{% block title %}{% trans 'Password change successful' %}{% endblock %}

{% block content %}
<div class="layout__article">
<h1 class="headline">{% trans 'Password change successful' %}</h1>

<p><a href="{% url "spirit:user:auth:login" %}"
<p><a href="{% url st_settings.LOGIN_URL %}"
>{% trans 'Continue to login' %}</a></p>
</div>
{% endblock %}
9 changes: 5 additions & 4 deletions spirit/user/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.contrib.auth import get_user_model
from django.urls import reverse_lazy

from spirit.core.conf import settings
from spirit.core.utils.views import is_post, post_data
from spirit.core.utils.ratelimit.decorators import ratelimit
from spirit.user.utils.email import send_activation_email
Expand Down Expand Up @@ -72,7 +73,7 @@ def custom_login(request, **kwargs):
# TODO: @login_required ?
def custom_logout(request, **kwargs):
if not request.user.is_authenticated:
return redirect(request.GET.get('next', reverse('spirit:user:auth:login')))
return redirect(request.GET.get('next', reverse(settings.LOGIN_URL)))

if request.method == 'POST':
return _logout_view(request, **kwargs)
Expand Down Expand Up @@ -110,7 +111,7 @@ def register(request, registration_form=RegistrationForm):
# login(request, user)
# return redirect(request.GET.get('next', reverse('spirit:user:update')))

return redirect(reverse('spirit:user:auth:login'))
return redirect(reverse(settings.LOGIN_URL))
return render(
request=request,
template_name='spirit/user/auth/register.html',
Expand All @@ -127,7 +128,7 @@ def registration_activation(request, pk, token):
user.save()
messages.info(request, _("Your account has been activated!"))

return redirect(reverse('spirit:user:auth:login'))
return redirect(reverse(settings.LOGIN_URL))


@ratelimit(field='email', rate='5/5m')
Expand All @@ -147,7 +148,7 @@ def resend_activation_email(request):
request, _(
"If you don't receive an email, please make sure you've entered "
"the address you registered with, and check your spam folder."))
return redirect(reverse('spirit:user:auth:login'))
return redirect(reverse(settings.LOGIN_URL))
return render(
request=request,
template_name='spirit/user/auth/activation_resend.html',
Expand Down

0 comments on commit da0b4bd

Please sign in to comment.