Commit 4e95aa05 by Greg Price

Fix marketing links in password reset pages

parent 3ee0ed9e
......@@ -47,6 +47,26 @@ def marketing_link(name):
return '#'
def marketing_link_context_processor(request):
"""
A django context processor to give templates access to marketing URLs
Returns a dict whose keys are the marketing link names usable with the
marketing_link method (e.g. 'ROOT', 'CONTACT', etc.) prefixed with
'MKTG_URL_' and whose values are the corresponding URLs as computed by the
marketing_link method.
"""
return dict(
[
("MKTG_URL_" + k, marketing_link(k))
for k in (
settings.MKTG_URL_LINK_MAP.viewkeys() |
settings.MKTG_URLS.viewkeys()
)
]
)
def render_to_string(template_name, dictionary, context=None, namespace='main'):
context_instance = Context(dictionary)
# add dictionary to context_instance
......
......@@ -175,6 +175,9 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
'course_wiki.course_nav.context_processor',
# Hack to get required link URLs to password reset templates
'mitxmako.shortcuts.marketing_link_context_processor',
)
STUDENT_FILEUPLOAD_MAX_SIZE = 4 * 1000 * 1000 # 4 MB
......
......@@ -44,7 +44,7 @@
<header class="global">
<nav>
<h1 class="logo">
<a href="/"><img src="/static/images/header-logo.png"></a>
<a href="{{MKTG_URL_ROOT}}"><img src="/static/images/header-logo.png"></a>
</h1>
</nav>
</header>
......@@ -59,7 +59,7 @@
{% block content %}
<section role="main" class="content">
<p>Your password has been set. You may go ahead and <a href="/">log in</a> now.</a>.</p>
<p>Your password has been set. You may go ahead and <a href="/login">log in</a> now.</a>.</p>
</section>
{% endblock %}
</section>
......
......@@ -43,7 +43,7 @@
<header class="global">
<nav>
<h1 class="logo">
<a href="/"><img src="/static/images/header-logo.png"></a>
<a href="{{MKTG_URL_ROOT}}"><img src="/static/images/header-logo.png"></a>
</h1>
</nav>
</header>
......@@ -79,7 +79,7 @@
<div role="alert" class="status message system-error">
<h3 class="message-title">We're sorry, our systems seem to be having trouble processing your password reset</h3>
<p class="message-copy">Someone has been made aware of this issue. Please try again shortly. Please <a href="">contact us</a> about any concerns you have.</p>
<p class="message-copy">Someone has been made aware of this issue. Please try again shortly. Please <a href="{{MKTG_URL_CONTACT}}">contact us</a> about any concerns you have.</p>
</div>
<p class="instructions">
......@@ -112,7 +112,7 @@
<header>
<h2 class="sr">Your Password Reset Was Unsuccessful</h2>
</header>
<p>The password reset link was invalid, possibly because the link has already been used. Please <a href="" class="action action-forgotpw" rel="modal">request a new password reset</a>.</p>
<p>The password reset link was invalid, possibly because the link has already been used. Please return to the <a href="/login">login page</a> and start the password reset process again.</p>
{% endif %}
</section>
......@@ -124,7 +124,7 @@
<div class="cta cta-help">
<h3>Need Help?</h3>
<p>View our <a href="#">help section for contact information and answers to commonly asked questions</a></p>
<p>View our <a href="{{MKTG_URL_FAQ}}">help section for contact information and answers to commonly asked questions</a></p>
</div>
</aside>
</section>
......
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