Skip to content

Commit b93d807

Browse files
authored
Fix "NoReverseMatch" for login URL (#1129)
1 parent 40ed228 commit b93d807

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

app/eventyay/base/templatetags/login_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def build_login_url(context):
1212
query_string = request.META.get('QUERY_STRING', '')
1313

1414
# Construct the base login URL
15-
login_url = reverse('control:auth.login')
15+
login_url = reverse('eventyay_common:auth.login')
1616

1717
# Encode the next parameter
1818
if query_string:

app/eventyay/eventyay_common/views/account/basic.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
from logging import getLogger
21
from collections import defaultdict
2+
from logging import getLogger
33

4-
from django.urls import reverse
5-
from django.shortcuts import redirect, get_object_or_404
6-
from django.http import HttpRequest, HttpResponse
7-
from django.views.generic import UpdateView, TemplateView, ListView
8-
from django.contrib.contenttypes.models import ContentType
9-
from django.contrib.auth import update_session_auth_hash
104
from django.contrib import messages
11-
from django.utils.translation import gettext_lazy as _
12-
from django.utils.functional import cached_property
5+
from django.contrib.auth import update_session_auth_hash
136
from django.contrib.auth.mixins import LoginRequiredMixin
7+
from django.contrib.contenttypes.models import ContentType
8+
from django.http import HttpRequest, HttpResponse
9+
from django.shortcuts import get_object_or_404, redirect
10+
from django.urls import reverse
11+
from django.utils.functional import cached_property
12+
from django.utils.translation import gettext_lazy as _
13+
from django.views.generic import ListView, TemplateView, UpdateView
1414
from django_scopes import scopes_disabled
1515

16-
from eventyay.base.models import User, Event, NotificationSetting, LogEntry
17-
from eventyay.base.notifications import get_all_notification_types
1816
from eventyay.base.forms.user import UserSettingsForm
17+
from eventyay.base.models import Event, LogEntry, NotificationSetting, User
18+
from eventyay.base.notifications import get_all_notification_types
19+
1920
from ...navigation import get_account_navigation
2021
from .common import AccountMenuMixIn
2122

22-
2323
logger = getLogger(__name__)
2424

2525

@@ -203,7 +203,7 @@ def post(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
203203
dest = (
204204
reverse('eventyay_common:account.notifications')
205205
if request.user.is_authenticated
206-
else reverse('control:auth.login')
206+
else reverse('eventyay_common:auth.login')
207207
)
208208
return redirect(dest)
209209

app/eventyay/plugins/socialauth/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def get(self, request: HttpRequest) -> HttpResponse:
7676
try:
7777
oauth2_params = OAuth2Params.model_validate(oauth2_params)
7878
query_string = urlencode(oauth2_params.model_dump())
79-
auth_url = reverse('control:oauth2_provider.authorize')
79+
auth_url = reverse('eventyay_common:oauth2_provider.authorize')
8080
return redirect(f'{auth_url}?{query_string}')
8181
except ValidationError as e:
8282
logger.warning('Ignore invalid OAuth2 parameters: %s.', e)
@@ -85,7 +85,7 @@ def get(self, request: HttpRequest) -> HttpResponse:
8585
except AttributeError as e:
8686
messages.error(request, _('Error while authorizing: no email address available.'))
8787
logger.error('Error while authorizing: %s', e)
88-
return redirect('control:auth.login')
88+
return redirect('eventyay_common:auth.login')
8989

9090
@staticmethod
9191
def get_or_create_user(request: HttpRequest) -> User:
@@ -112,7 +112,8 @@ def get_or_create_user(request: HttpRequest) -> User:
112112
},
113113
)
114114

115-
# Update wikimedia_username if the user exists but has no wikimedia_username value set (Basically our existing users), or if the user has updated his username in his wikimedia account
115+
# Update wikimedia_username if the user exists but has no wikimedia_username value set
116+
# (basically our existing users), or if the user has updated his username in his wikimedia account
116117
if not created and (not user.wikimedia_username or user.wikimedia_username != wikimedia_username):
117118
user.wikimedia_username = wikimedia_username
118119
user.save()

app/eventyay/presale/templates/pretixpresale/fragment_modals.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="modal-card-content">
1111
<h3></h3>
1212
<p class="text"></p>
13-
<p class="status">{% trans "If the process continues for an extended period, feel free to reach out to us." %}</p>
13+
<p class="status">{% translate 'If the process continues for an extended period, feel free to reach out to us.' %}</p>
1414
</div>
1515
</div>
1616
</div>
@@ -19,23 +19,23 @@ <h3></h3>
1919
<div class="modal-card-content-join">
2020
<div>
2121
<h3>
22-
{% trans "This is a ticketed event. If you ordered a ticket as a guest user, you don't have an account but can still access the ticket using the secret link in your ticket confirmation email. On the tickets page there is also a link to join online sessions." %}
22+
{% translate "This is a ticketed event. If you ordered a ticket as a guest user, you don't have an account but can still access the ticket using the secret link in your ticket confirmation email. On the tickets page there is also a link to join online sessions." %}
2323
</h3>
2424
<h3>
25-
{% trans "As a ticket holder please also check your email for the unique link to join online sessions." %}
25+
{% translate 'As a ticket holder please also check your email for the unique link to join online sessions.' %}
2626
</h3>
2727
{% if request.event %}
2828
<p class="text">
29-
{% trans "Can't find your ticket?" %}
29+
{% translate "Can't find your ticket?" %}
3030
<a class="btn btn-link" href='{% eventurl request.event "presale:event.resend_link" %}'>
31-
{% trans "Resend the email" %}
31+
{% translate 'Resend the email' %}
3232
</a>
33-
{% trans "to receive it." %}
33+
{% translate 'to receive it.' %}
3434
</p>
3535
<p class="text">
36-
{% trans "Want to order a ticket?" %}
36+
{% translate 'Want to order a ticket?' %}
3737
<a class="btn btn-link" href='{% eventurl request.event "presale:event.index" %}'>
38-
{% trans "Get a ticket here" %}
38+
{% translate 'Get a ticket here' %}
3939
</a>
4040
</p>
4141
{% endif %}
@@ -44,16 +44,16 @@ <h3>
4444
{% blocktrans with event_name=event_name %}
4545
Want to create a {{ event_name }} account?
4646
{% endblocktrans %}
47-
<a class="btn btn-link" href='{% url "control:auth.register" %}?next={{ request.get_full_path|urlencode }}'>
48-
{% trans "Sign up here" %}
47+
<a class="btn btn-link" href='{% url "eventyay_common:auth.register" %}?next={{ request.get_full_path|urlencode }}'>
48+
{% translate 'Sign up here' %}
4949
</a>
5050
</p>
5151
<p class="text">
5252
{% blocktrans with event_name=event_name %}
5353
Already have a {{ event_name }} account?
5454
{% endblocktrans %}
55-
<a class="btn btn-link" href='{% url "control:auth.login" %}?next={{ request.get_full_path|urlencode }}'>
56-
{% trans "Login here" %}
55+
<a class="btn btn-link" href='{% url "eventyay_common:auth.login" %}?next={{ request.get_full_path|urlencode }}'>
56+
{% translate 'Login here' %}
5757
</a>
5858
</p>
5959
{% endif %}

0 commit comments

Comments
 (0)