user login and redirect after registration
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user