Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Fix Bug 721171 with submit demo register link
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Feb 9, 2012
1 parent ae17ac1 commit 0ea3705
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 25 deletions.
11 changes: 0 additions & 11 deletions apps/users/templates/users/browserid_login_form.html

This file was deleted.

2 changes: 1 addition & 1 deletion apps/users/templates/users/browserid_signin.html
@@ -1,4 +1,4 @@
{% from "layout/errorlist.html" import errorlist %}
{% from "layout/errorlist.html" import errorlist %}
<h1>{{ _('Sign In with BrowserID') }}</h1>
<form class="browserid boxed" action="{{url('users.browserid_verify')}}" method="POST">
<input type="hidden" name="next" value="{{ next_url }}" />
Expand Down
2 changes: 1 addition & 1 deletion apps/users/templates/users/login.html
Expand Up @@ -21,7 +21,7 @@ <h1>{{ _('Log In') }}</h1>
{% block js %}
{% if use_browserid %}
<script type="text/javascript">
$('article#login').load($('article#login').attr('data-browserid-signin-html'), bindBrowserIDSignin);
$('article.main').load($('article.main').attr('data-browserid-signin-html'), bindBrowserIDSignin);
</script>
{% endif %}
{% endblock %}
15 changes: 9 additions & 6 deletions apps/users/templates/users/register.html
Expand Up @@ -9,11 +9,7 @@
<section id="content">
<div class="wrap">
<div id="content-main" class="full">
<article id="register" class="main">
{% if use_browserid %}
<h1>{{ _('Sign In with BrowserID') }}</h1>
{% include "users/browserid_login_form.html" %}
{% else %}
<article id="register" class="main" data-browserid-signin-html="{{ url('users.browserid_signin_html') }}">
<h1>{{ _('Register') }}</h1>
<p>{% trans %}
You can access everything on the MDN website even without an account, but
Expand All @@ -31,9 +27,16 @@ <h1>{{ _('Register') }}</h1>
<li class="submit"><button type="submit">{{ _('Register') }}</button></li>
</ul>
</form>
{% endif %}
</article>
</div>
</div>
</section>
{% endblock %}

{% block js %}
{% if use_browserid %}
<script type="text/javascript">
$('article.main').load($('article.main').attr('data-browserid-signin-html'), bindBrowserIDSignin);
</script>
{% endif %}
{% endblock %}
4 changes: 0 additions & 4 deletions apps/users/tests/test_views.py
Expand Up @@ -516,8 +516,6 @@ def test_valid_assertion_with_django_user(self, _verify_browserid):
def test_explain_popup(self, _verify_browserid):
_verify_browserid.return_value = {'email': 'testuser2@test.com'}
resp = self.client.get(reverse('home', locale='en-US'))
doc = pq(resp.content)
# eq_(True, 'toggle' in doc.find('li#user-signin').html())

# Posting the fake assertion to browserid_verify should work, with the
# actual verification method mocked out.
Expand All @@ -531,8 +529,6 @@ def test_explain_popup(self, _verify_browserid):
# even after logout, cookie should prevent the toggle
resp = self.client.get(reverse('home', locale='en-US'))
eq_('1', self.client.cookies.get('browserid_explained').value)
# doc = pq(resp.content)
# eq_(False, 'toggle' in doc.find('li#user-signin').html())

@mock_get_deki_user_by_email
@mock_put_mindtouch_user
Expand Down
6 changes: 4 additions & 2 deletions apps/users/views.py
Expand Up @@ -81,13 +81,15 @@ def set_browserid_explained(response):


def browserid_header_signin_html(request):
if request.locale not in constance.config.BROWSERID_LOCALES:
browserid_locales = constance.config.BROWSERID_LOCALES
if request.locale.lower() not in browserid_locales.lower():
raise Http404
return jingo.render(request, 'users/browserid_header_signin.html')


def browserid_signin_html(request):
if request.locale not in constance.config.BROWSERID_LOCALES:
browserid_locales = constance.config.BROWSERID_LOCALES
if request.locale.lower() not in browserid_locales.lower():
raise Http404
form = handle_login(request)
return jingo.render(request, 'users/browserid_signin.html', {'form': form})
Expand Down

0 comments on commit 0ea3705

Please sign in to comment.