2018-11-03 04:24:11 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.contrib.auth import login, authenticate
|
|
|
|
from django.http import HttpResponseRedirect
|
|
|
|
from django.shortcuts import render
|
|
|
|
|
|
|
|
from .forms import SignUpForm
|
|
|
|
from .ldap_funcs import create_user
|
|
|
|
|
|
|
|
|
2018-11-10 05:07:50 +00:00
|
|
|
# def signup(request):
|
|
|
|
# if request.method == 'POST':
|
|
|
|
# form = SignUpForm(request.POST)
|
|
|
|
# if form.is_valid():
|
|
|
|
# username = form.cleaned_data.get('username')
|
|
|
|
# raw_password = form.cleaned_data.get('password1')
|
|
|
|
# first_name = form.cleaned_data.get('first_name')
|
|
|
|
# last_name = form.cleaned_data.get('last_name')
|
|
|
|
# email = form.cleaned_data.get('email')
|
|
|
|
# create_user(username, raw_password, first_name, last_name, email)
|
|
|
|
# form.save()
|
|
|
|
# user = authenticate(username=username, password=raw_password)
|
|
|
|
# login(request, user, backend='django_auth_ldap.backend.LDAPBackend')
|
|
|
|
# return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL)
|
|
|
|
# else:
|
|
|
|
# form = SignUpForm()
|
|
|
|
# return render(request, 'users/signup.html', {'form': form})
|
|
|
|
|
|
|
|
|
2018-11-03 04:24:11 +00:00
|
|
|
def signup(request):
|
2018-11-10 05:07:50 +00:00
|
|
|
return HttpResponseRedirect("https://account.ungleich.ch/register/")
|