Private
Public Access
1
0

user login and redirect after registration

This commit is contained in:
Sander Roosendaal
2018-11-29 08:40:25 +01:00
parent 9d8af5a767
commit f8066c8c7d
8 changed files with 74 additions and 19 deletions

View File

@@ -1028,6 +1028,9 @@ def add_defaultfavorites(r):
# User registration
def rower_register_view(request):
nextpage = request.GET.get('next','/rowers/list-workouts/')
if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST)
form = RegistrationFormSex(request.POST)
@@ -1040,6 +1043,7 @@ def rower_register_view(request):
sex = form.cleaned_data['sex']
birthdate = form.cleaned_data['birthdate']
weightcategory = form.cleaned_data['weightcategory']
nextpage = request.POST['next']
theuser = User.objects.create_user(username,password=password)
theuser.first_name = first_name
theuser.last_name = last_name
@@ -1088,17 +1092,23 @@ def rower_register_view(request):
'Rowsandall Server <info@rowsandall.com>',
['roosendaalsander@gmail.com'])
return HttpResponseRedirect('/rowers/register/thankyou/')
theuser = authenticate(username=username,password=password)
login(request,theuser)
return HttpResponseRedirect(nextpage)
# '/rowers/register/thankyou/')
else:
return render(request,
"registration_form.html",
{'form':form})
{'form':form,
'next':nextpage,})
else:
form = RegistrationFormSex()
return render(request,
"registration_form.html",
{'form':form,})
{'form':form,
'next':nextpage,})
# Shows analysis page
@login_required()