1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-27 02:43:01 +00:00

If connected and if we have the right, directly redirect to the validation page when registering someone

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2021-09-07 10:56:50 +02:00
parent 391f3bde8f
commit fb6e3c3de0
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -85,6 +85,9 @@ class UserCreateView(CreateView):
return super().form_valid(form) return super().form_valid(form)
def get_success_url(self): def get_success_url(self):
# Direct access to validation menu if we have the right to validate it
if PermissionBackend.check_perm(self.request, 'auth.view_user', self.object):
return reverse_lazy('registration:future_user_detail', args=(self.object.pk,))
return reverse_lazy('registration:email_validation_sent') return reverse_lazy('registration:email_validation_sent')