Klaus-Uwe Mitterer
54e84be36a
Copy over payment system from kumi.xxx Add missing requirements Other stuff
24 lines
No EOL
807 B
Python
24 lines
No EOL
807 B
Python
from django.contrib.auth.views import LoginView as Login, LogoutView as Logout
|
|
from django.http.response import HttpResponseRedirect
|
|
from django.contrib.auth import login
|
|
|
|
from .forms import RegistrationForm
|
|
from .models import User
|
|
|
|
class LoginView(Login):
|
|
template_name = "localauth/register.html"
|
|
|
|
class LogoutView(Logout):
|
|
next_page = "/"
|
|
|
|
class RegistrationView(Login):
|
|
form_class = RegistrationForm
|
|
template_name = "localauth/register.html"
|
|
|
|
def form_valid(self, form):
|
|
user = User.objects.create_user(form.cleaned_data["email"], form.cleaned_data["password1"])
|
|
login(self.request, user)
|
|
return HttpResponseRedirect(self.get_success_url())
|
|
|
|
def get_default_redirect_url(self):
|
|
return resolve_url(self.next_page or settings.REGISTER_REDIRECT_URL) |