2
0
Fork 0

Redirect to 'register' page and show warning if token is not found

This commit is contained in:
Luca 2023-04-21 22:03:55 +02:00
parent 8e4918ec67
commit 2659273824
1 changed files with 10 additions and 1 deletions

View File

@ -72,7 +72,16 @@ def index(request):
def login(request, token): def login(request, token):
tk = get_object_or_404(LoginToken, pk=token) try:
tk = LoginToken.objects.get(pk=token)
except LoginToken.DoesNotExist:
messages.add_message(
request,
messages.WARNING,
"Wir konnten dich nicht in unserer Datenbank finden. Beachte bitte, dass du dich neu registrieren musst, auch wenn du letztes Jahr bereits geholfen hast.",
)
return redirect("register")
if not tk.helper.number_validated: if not tk.helper.number_validated:
tk.helper.number_validated = True tk.helper.number_validated = True
tk.helper.save() tk.helper.save()