From 6f06a3d92af8c19f66e1506bc191a2fc147d869e Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 8 May 2013 15:22:22 -0400 Subject: [PATCH] Make login link button in header work with course enrollment flow When an unauthenticated user clicks the registration button for a course, they are redirected to the registration page with query params that are ultimately included in the form that gets submitted so they can be enrolled in the course upon successful registration. The header login button is fixed to pass the same query parameters to the login page so the user can be enrolled in the course upon successful login. --- lms/templates/main.html | 8 ++++++++ lms/templates/navigation.html | 6 ++---- lms/templates/register.html | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lms/templates/main.html b/lms/templates/main.html index 02e3c9fa46..313025d09a 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -1,4 +1,5 @@ <%namespace name='static' file='static_content.html'/> +<%! from django.utils import html %> @@ -57,3 +58,10 @@ <%block name="js_extra"/> + +<%def name="login_query()">${ + "?course_id={0}&enrollment_action={1}".format( + html.escape(course_id), + html.escape(enrollment_action) + ) if course_id and enrollment_action else "" +} diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index c555d8492f..82d08f6ca9 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -1,8 +1,6 @@ ## mako -## TODO: Split this into two files, one for people who are authenticated, and -## one for people who aren't. Assume a Course object is passed to the former, -## instead of using settings.COURSE_TITLE <%namespace name='static' file='static_content.html'/> +<%namespace file='main.html' import="login_query"/> <%! from django.core.urlresolvers import reverse @@ -97,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id) diff --git a/lms/templates/register.html b/lms/templates/register.html index ddf472e9df..06b6fe169a 100644 --- a/lms/templates/register.html +++ b/lms/templates/register.html @@ -1,7 +1,9 @@ <%inherit file="main.html" /> <%namespace name='static' file='static_content.html'/> +<%namespace file='main.html' import="login_query"/> <%! from django.core.urlresolvers import reverse %> +<%! from django.utils import html %> <%! from django_countries.countries import COUNTRIES %> <%! from student.models import UserProfile %> <%! from datetime import date %> @@ -239,16 +241,14 @@

Registration Help

-% if course_id and enrollment_action:

Already registered?

- + Click here to log in.

-% endif

Welcome to edX