mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
Avoid anonymous users to access to the WEI registration form
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
fb98d9cd8b
commit
db936bf75a
@ -511,7 +511,8 @@ class WEIRegister1AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
if today >= wei.date_start or today < wei.membership_start:
|
if today >= wei.date_start or today < wei.membership_start:
|
||||||
return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,)))
|
return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,)))
|
||||||
# Don't register twice
|
# Don't register twice
|
||||||
if 'myself' in self.request.path and WEIRegistration.objects.filter(wei=wei, user=self.request.user).exists():
|
if 'myself' in self.request.path and not self.request.user.is_anonymous \
|
||||||
|
and WEIRegistration.objects.filter(wei=wei, user=self.request.user).exists():
|
||||||
obj = WEIRegistration.objects.get(wei=wei, user=self.request.user)
|
obj = WEIRegistration.objects.get(wei=wei, user=self.request.user)
|
||||||
return redirect(reverse_lazy('wei:wei_update_registration', args=(obj.pk,)))
|
return redirect(reverse_lazy('wei:wei_update_registration', args=(obj.pk,)))
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
@ -590,7 +591,8 @@ class WEIRegister2AView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
if today >= wei.date_start or today < wei.membership_start:
|
if today >= wei.date_start or today < wei.membership_start:
|
||||||
return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,)))
|
return redirect(reverse_lazy('wei:wei_closed', args=(wei.pk,)))
|
||||||
# Don't register twice
|
# Don't register twice
|
||||||
if 'myself' in self.request.path and WEIRegistration.objects.filter(wei=wei, user=self.request.user).exists():
|
if 'myself' in self.request.path and not self.request.user.is_anonymous \
|
||||||
|
and WEIRegistration.objects.filter(wei=wei, user=self.request.user).exists():
|
||||||
obj = WEIRegistration.objects.get(wei=wei, user=self.request.user)
|
obj = WEIRegistration.objects.get(wei=wei, user=self.request.user)
|
||||||
return redirect(reverse_lazy('wei:wei_update_registration', args=(obj.pk,)))
|
return redirect(reverse_lazy('wei:wei_update_registration', args=(obj.pk,)))
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user