Use a standard login handler

Is there any reason to not use the standard login decorator?
This commit is contained in:
Sachi King 2017-05-07 19:19:53 +10:00
parent 8cb7bcc021
commit 4a5e4dc6ea

View file

@ -71,10 +71,10 @@ def speaker_create_staff(request, pk):
}) })
@login_required
def speaker_create_token(request, token): def speaker_create_token(request, token):
speaker = get_object_or_404(Speaker, invite_token=token) speaker = get_object_or_404(Speaker, invite_token=token)
request.session["pending-token"] = token request.session["pending-token"] = token
if request.user.is_authenticated():
# check for speaker profile # check for speaker profile
try: try:
existing_speaker = request.user.speaker_profile existing_speaker = request.user.speaker_profile
@ -91,9 +91,6 @@ def speaker_create_token(request, token):
messages.info(request, _("You have been associated with all pending " messages.info(request, _("You have been associated with all pending "
"talk proposals")) "talk proposals"))
return redirect("dashboard") return redirect("dashboard")
else:
if not request.user.is_authenticated():
return redirect("account_login")
return redirect("speaker_create") return redirect("speaker_create")