Redirect to 'register' page and show warning if token is not found
This commit is contained in:
parent
8e4918ec67
commit
2659273824
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue