Commit 6f06a3d9 by Greg Price

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.
parent a0fb4d6c
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%! from django.utils import html %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
...@@ -57,3 +58,10 @@ ...@@ -57,3 +58,10 @@
<%block name="js_extra"/> <%block name="js_extra"/>
</body> </body>
</html> </html>
<%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 ""
}</%def>
## mako ## 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 name='static' file='static_content.html'/>
<%namespace file='main.html' import="login_query"/>
<%! <%!
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -97,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -97,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id)
<ol class="right nav-courseware"> <ol class="right nav-courseware">
<li class="nav-courseware-01"> <li class="nav-courseware-01">
% if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']:
<a class="cta cta-login" href="/login">Log in</a> <a class="cta cta-login" href="/login${login_query()}">Log in</a>
% endif % endif
</li> </li>
</ol> </ol>
......
<%inherit file="main.html" /> <%inherit file="main.html" />
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%namespace file='main.html' import="login_query"/>
<%! from django.core.urlresolvers import reverse %> <%! from django.core.urlresolvers import reverse %>
<%! from django.utils import html %>
<%! from django_countries.countries import COUNTRIES %> <%! from django_countries.countries import COUNTRIES %>
<%! from student.models import UserProfile %> <%! from student.models import UserProfile %>
<%! from datetime import date %> <%! from datetime import date %>
...@@ -239,16 +241,14 @@ ...@@ -239,16 +241,14 @@
<h3 class="sr">Registration Help</h3> <h3 class="sr">Registration Help</h3>
</header> </header>
% if course_id and enrollment_action:
<div class="cta"> <div class="cta">
<h3>Already registered?</h3> <h3>Already registered?</h3>
<p class="instructions"> <p class="instructions">
<a href="${reverse('signin_user')}?course_id=${course_id | h}&enrollment_action=${enrollment_action | h}"> <a href="${reverse('signin_user')}${login_query()}">
Click here to log in. Click here to log in.
</a> </a>
</p> </p>
</div> </div>
% endif
<div class="cta cta-welcome"> <div class="cta cta-welcome">
<h3>Welcome to edX</h3> <h3>Welcome to edX</h3>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment