Skip to content
Snippets Groups Projects
Commit 1e26aca5 authored by Sylvain Llop's avatar Sylvain Llop
Browse files

update: redirect to default

parent 7a22f49e
No related branches found
No related tags found
2 merge requests!91Django registration simple,!90update: redirect to default
Pipeline #10283 passed
...@@ -3,7 +3,7 @@ from django.views import View ...@@ -3,7 +3,7 @@ from django.views import View
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.views import LoginView, SuccessURLAllowedHostsMixin from django.contrib.auth.views import LoginView, SuccessURLAllowedHostsMixin
from django.shortcuts import redirect, render from django.shortcuts import redirect, render
from django.urls import reverse from django.urls import reverse, reverse_lazy
from django.utils.http import ( from django.utils.http import (
is_safe_url, urlsafe_base64_decode, is_safe_url, urlsafe_base64_decode,
) )
...@@ -169,6 +169,7 @@ class LDPAccountRegistrationView(SuccessURLAllowedHostsMixin, RegistrationView): ...@@ -169,6 +169,7 @@ class LDPAccountRegistrationView(SuccessURLAllowedHostsMixin, RegistrationView):
def register(self, form): def register(self, form):
from django.conf import settings from django.conf import settings
if getattr(settings, 'SIMPLE_REGISTRATION', False): if getattr(settings, 'SIMPLE_REGISTRATION', False):
self.success_url = reverse_lazy("redirect-default")
new_user = form.save() new_user = form.save()
new_user = authenticate( new_user = authenticate(
**{ **{
...@@ -181,7 +182,7 @@ class LDPAccountRegistrationView(SuccessURLAllowedHostsMixin, RegistrationView): ...@@ -181,7 +182,7 @@ class LDPAccountRegistrationView(SuccessURLAllowedHostsMixin, RegistrationView):
sender=self.__class__, user=new_user, request=self.request sender=self.__class__, user=new_user, request=self.request
) )
return new_user return new_user
return super.register(form) return super().register(form)
class RPLoginView(View): class RPLoginView(View):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment