From 62627a80cf1264ff0d8c4c80cfbdc65f25816b81 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 8 Mar 2013 02:43:11 -0500 Subject: [PATCH] fix "next" behavior, poor sign-up/pledge flow [#40841931] Sign In lightbox had broken cookie pusher on reg/auth pages. Many holes had developed that broke return-to-page-after-auth (for example, sign-in from pledge page). Sporadic encoding issues. --- api/templates/api_help.html | 2 +- frontend/templates/about_lightbox_footer.html | 2 +- frontend/templates/base.html | 9 ++++----- frontend/templates/comments/preview.html | 2 +- frontend/templates/download.html | 2 +- frontend/templates/fund_the_pledge.html | 2 +- frontend/templates/home.html | 4 ++-- frontend/templates/libraries.html | 4 ++-- frontend/templates/registration/login.html | 2 +- .../templates/registration/password_change_form.html | 2 +- .../templates/registration/registration_complete.html | 8 ++++++++ frontend/templates/registration/registration_form.html | 2 +- frontend/templates/work.html | 2 +- static/js/hijax.js | 10 ++++++++++ 14 files changed, 35 insertions(+), 18 deletions(-) diff --git a/api/templates/api_help.html b/api/templates/api_help.html index 36c6eb53..1a09b94f 100644 --- a/api/templates/api_help.html +++ b/api/templates/api_help.html @@ -10,7 +10,7 @@ {% if user.is_authenticated %}

Welcome {{user.username}}. Your API key is {{api_key}}.

{% else %} -

Please sign in first.

+

Please sign in first.

{% endif %}

Basic API info

diff --git a/frontend/templates/about_lightbox_footer.html b/frontend/templates/about_lightbox_footer.html index 9128ea49..c5b8c166 100644 --- a/frontend/templates/about_lightbox_footer.html +++ b/frontend/templates/about_lightbox_footer.html @@ -2,7 +2,7 @@
Read the FAQ for authors and publishers
Our press coverage
{% if not user.is_authenticated %} -
Sign up today
+
Sign up today
{% else %}
Our campaigns
{% endif %} diff --git a/frontend/templates/base.html b/frontend/templates/base.html index c9196dd4..9104e3a7 100644 --- a/frontend/templates/base.html +++ b/frontend/templates/base.html @@ -24,7 +24,7 @@ {% block base_js %} {% endblock %} - + {% block extra_js %} {% endblock %} @@ -58,7 +58,6 @@ -

Feedback

@@ -124,13 +123,13 @@ {% else %}
diff --git a/frontend/templates/comments/preview.html b/frontend/templates/comments/preview.html index 5118a345..ea56bec2 100644 --- a/frontend/templates/comments/preview.html +++ b/frontend/templates/comments/preview.html @@ -11,7 +11,7 @@
{% if request.user.is_anonymous %} -

You must be logged in to comment.

+

You must be logged in to comment.

{% else %}
{% csrf_token %} {% if next %}
{% endif %} diff --git a/frontend/templates/download.html b/frontend/templates/download.html index f398cdd0..03646e54 100644 --- a/frontend/templates/download.html +++ b/frontend/templates/download.html @@ -22,7 +22,7 @@ {% endwith %} - +
  • Embed
  • Copy/paste this into your site:
    diff --git a/frontend/templates/fund_the_pledge.html b/frontend/templates/fund_the_pledge.html index f5c8d0b1..3f8606fa 100644 --- a/frontend/templates/fund_the_pledge.html +++ b/frontend/templates/fund_the_pledge.html @@ -119,7 +119,7 @@ $j(document).ready(function() {

    -

    Want to use a different card? You can change your credit card info on your Account & Pledges page. +

    Want to use a different card? You can change your credit card info on your Account & Pledges page.

    {% else %}
    diff --git a/frontend/templates/home.html b/frontend/templates/home.html index 0e1ff2b1..8f7f4d98 100755 --- a/frontend/templates/home.html +++ b/frontend/templates/home.html @@ -68,7 +68,7 @@
    {% else %}
    @@ -143,7 +143,7 @@
    diff --git a/frontend/templates/libraries.html b/frontend/templates/libraries.html index b993acdb..535a0fa8 100644 --- a/frontend/templates/libraries.html +++ b/frontend/templates/libraries.html @@ -27,8 +27,8 @@

    We need your help, though. We can't unglue ebooks all by ourselves; we need lots of people to pitch in. If you'd like to share free, unlimited, no-DRM, privacy-respecting ebooks with your patrons, here are some ways you can help:

    -
    Sign up.
    -
    Starting an account, for yourself or your library, is free, and lets you add books to your wishlist, comment on them, and support campaigns. Sign up here.
    +
    Sign up.
    +
    Starting an account, for yourself or your library, is free, and lets you add books to your wishlist, comment on them, and support campaigns. Sign up here.
    Stay in touch.
    You can follow us on Twitter (@unglueit), Facebook, and our blog, and subscribe to our newsletter (1-2 emails per month).
    Add unglued ebooks to your collection.
    diff --git a/frontend/templates/registration/login.html b/frontend/templates/registration/login.html index b67cf6ff..377b2b06 100644 --- a/frontend/templates/registration/login.html +++ b/frontend/templates/registration/login.html @@ -15,7 +15,7 @@ Make sure the username box has your username, not your email -- some brow
    -Forgot your password? Need an account? Other questions? +Forgot your password? Need an account? Other questions?

    diff --git a/frontend/templates/registration/password_change_form.html b/frontend/templates/registration/password_change_form.html index 29b72918..ee7133c7 100644 --- a/frontend/templates/registration/password_change_form.html +++ b/frontend/templates/registration/password_change_form.html @@ -18,7 +18,7 @@ {% endifequal %} {% else %}
    You must be logged in to change your password.
    -
    Log in
    +
    Log in
    {% endif %}

    Want to change your username instead?

    diff --git a/frontend/templates/registration/registration_complete.html b/frontend/templates/registration/registration_complete.html index a443250c..3f228dff 100644 --- a/frontend/templates/registration/registration_complete.html +++ b/frontend/templates/registration/registration_complete.html @@ -3,7 +3,15 @@ {% block doccontent %} {% if not user.is_authenticated %} +

    An account activation email has been sent. Please check your email and click on the link to activate your account. We're also sending you an invitation to our email newsletter. It comes out about twice a month. Put "gluenews@gluejar.com" in your contact list to make sure you get it. +

    + {% if request.COOKIES.next %} + +

    + You can also go back to the page where you were. +

    + {% endif %} {% else %}
    You are logged in as {{ request.user.username }}. diff --git a/frontend/templates/registration/registration_form.html b/frontend/templates/registration/registration_form.html index 0c0cb8dc..1a859892 100644 --- a/frontend/templates/registration/registration_form.html +++ b/frontend/templates/registration/registration_form.html @@ -15,7 +15,7 @@
    {% else %}
    diff --git a/frontend/templates/work.html b/frontend/templates/work.html index d036b8c5..ac9754c1 100644 --- a/frontend/templates/work.html +++ b/frontend/templates/work.html @@ -264,7 +264,7 @@ $j(document).ready(function(){ {% if user.is_authenticated %} {% render_comment_form for work %} {% else %} -

    You must be logged in to comment.

    +

    You must be logged in to comment.

    {% endif %}
    diff --git a/static/js/hijax.js b/static/js/hijax.js index 80d6667a..760590e3 100644 --- a/static/js/hijax.js +++ b/static/js/hijax.js @@ -23,6 +23,16 @@ $j(document).ready(function() { jQuery.getScript('https://platform.readmill.com/send.js'); } + //need to push next cookie for sign-in links + var vars = $j(this).attr("href").split("next="); + if (vars.length>1){ + next=vars[1]; + if(next!='') { + next = next.replace(/[\x22\x27\x3c\x3e]/g,''); + $j.cookie('next', next, {path: '/'}); + } + } + // fade-out rest of page elements on expand $j('#feedback, #js-page-wrap, #footer').css({"opacity": "0.07"}); $j('#about_expandable').css({'position': 'absolute'});