From f8066c8c7dc602f360135d554347ae438b9c04b3 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Thu, 29 Nov 2018 08:40:25 +0100 Subject: [PATCH] user login and redirect after registration --- rowers/templates/gdpr_optin.html | 3 +- rowers/templates/registration/login.html | 12 +++++-- rowers/templates/registration_form.html | 5 +-- rowers/templates/virtualevent.html | 46 +++++++++++++++++++++--- rowers/templates/workout_view.html | 7 ++-- rowers/views.py | 16 +++++++-- templates/newbase.html | 2 +- templates/newbasefront.html | 2 +- 8 files changed, 74 insertions(+), 19 deletions(-) diff --git a/rowers/templates/gdpr_optin.html b/rowers/templates/gdpr_optin.html index 19255535..311816ac 100644 --- a/rowers/templates/gdpr_optin.html +++ b/rowers/templates/gdpr_optin.html @@ -7,7 +7,8 @@ {% block main %}

We know you are eager to start using rowsandall.com, but we must - ask you to read and agree with the below first. + ask you to read and agree with the below first. At the bottom of this page, + you can opt in or delete this user account.

GDPR Opt-In

diff --git a/rowers/templates/registration/login.html b/rowers/templates/registration/login.html index e2d74eb2..eef08c5e 100644 --- a/rowers/templates/registration/login.html +++ b/rowers/templates/registration/login.html @@ -21,14 +21,22 @@ - Forgot password? +

Forgot password?

+ + + +

Register New User

+ + + + - + diff --git a/rowers/templates/registration_form.html b/rowers/templates/registration_form.html index bd75d942..e09e9365 100644 --- a/rowers/templates/registration_form.html +++ b/rowers/templates/registration_form.html @@ -1,7 +1,7 @@ {% extends "newbase.html" %} {% load staticfiles %} {% load rowerfilters %} -{% block title %}Contact Us{% endblock title %} +{% block title %}New User Registration{% endblock title %} {% block meta %} {% endblock %} @@ -23,7 +23,8 @@ {{ form.as_table }} Terms of Service - + + diff --git a/rowers/templates/virtualevent.html b/rowers/templates/virtualevent.html index bab556b1..97e94b79 100644 --- a/rowers/templates/virtualevent.html +++ b/rowers/templates/virtualevent.html @@ -8,11 +8,42 @@ {% include "monitorjobs.html" %} {% endblock %} +{% block og_title %}{{ race.name }}{% endblock %} +{% block description %}Virtual Rowing Race {{ race.name }}{% endblock %} + +{% if racelogo %} +{% block og_image %} + + + + +{% endblock %} +{% block image_src %} + +{% endblock %} +{% endif %} + {% block main %}

{{ race.name }}

+

+

+ Share +
+

+

+ +

+ + {% if not racelogo and race.manager == request.user %} Add Race Logo {% endif %} @@ -95,9 +126,14 @@
{% if request.user.is_anonymous %} -

- Registered users of rowsandall.com can participate in this event. Participation is free, unless specified differently in the race comment above. -

+

+ Registered users of rowsandall.com can participate in this event. Participation is free, unless specified differently in the race comment above. + {% if race.sessiontype == 'race' %} +

Register

+ {% else %} +

Register

+ {% endif %} +

{% else %}

See race rules below. Participation to this race is free, @@ -108,9 +144,9 @@ {% if button == 'registerbutton' %}

{% if race.sessiontype == 'race' %} - Register +

Register

{% else %} - Register +

Register

{% endif %}

{% endif %} diff --git a/rowers/templates/workout_view.html b/rowers/templates/workout_view.html index 852444d6..33d7856d 100644 --- a/rowers/templates/workout_view.html +++ b/rowers/templates/workout_view.html @@ -11,11 +11,10 @@ {{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %} {% block og_description %}{{ workout.name }} {{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %} -{% if graphs1 %} -{% endif %} -{% for graph in graphs1 %} + +{% for graph in graphs %} {% block og_image %} -{% if graphs1 %} +{% if graphs %} {% for graph in graphs %} diff --git a/rowers/views.py b/rowers/views.py index 88636c8e..5f4dff65 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -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 ', ['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() diff --git a/templates/newbase.html b/templates/newbase.html index 6f6a1c7c..755e5667 100644 --- a/templates/newbase.html +++ b/templates/newbase.html @@ -157,7 +157,7 @@ {% elif user.rower.rowerplan == 'plan' %} {% else %} - + {% endif %} diff --git a/templates/newbasefront.html b/templates/newbasefront.html index 97cba250..85abb700 100644 --- a/templates/newbasefront.html +++ b/templates/newbasefront.html @@ -173,7 +173,7 @@ {% elif user.rower.rowerplan == 'plan' %} {% else %} - + {% endif %}