Require login for proposal submit

- This has the effect of bouncing people to the login page if they're
  unauthenticated, rather than returning a 502 because 'home' doesn't
  exist.

- If they're authenticated but don't have a speaker profile, send them
  to the speaker profile create page rather than just to the
  dashboard.

Closes #26
This commit is contained in:
James Polley 2017-10-16 15:07:36 +11:00
parent bb42d098fd
commit 6bf3d71bff

View file

@ -60,18 +60,15 @@ def proposal_submit(request):
"kinds": kinds,
})
@login_required
def proposal_submit_kind(request, kind_slug):
kind = get_object_or_404(ProposalKind, slug=kind_slug)
if not request.user.is_authenticated():
return redirect("home") # @@@ unauth'd speaker info page?
else:
try:
speaker_profile = request.user.speaker_profile
except ObjectDoesNotExist:
return redirect("dashboard")
try:
speaker_profile = request.user.speaker_profile
except ObjectDoesNotExist:
return redirect("speaker_create")
if not kind.section.proposalsection.is_available():
return redirect("proposal_submit")