nicer social auth
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 12 Mar 2012 12:43:40 +0000 (13:43 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 12 Mar 2012 15:52:03 +0000 (16:52 +0100)
13 files changed:
apps/ajaxable/templatetags/__init__.py [new file with mode: 0644]
apps/ajaxable/templatetags/ajaxable_tags.py [new file with mode: 0644]
requirements.txt
wolnelektury/static/img/auth/facebook.png [new file with mode: 0644]
wolnelektury/static/img/auth/google-icon.png [deleted file]
wolnelektury/static/img/auth/openid-large.png?1237615666 [deleted file]
wolnelektury/static/img/auth/twitter.png [new file with mode: 0644]
wolnelektury/static/js/dialogs.js
wolnelektury/templates/auth/login.html
wolnelektury/templates/auth/login_register.html
wolnelektury/templates/openid/login.html [new file with mode: 0644]
wolnelektury/templates/socialaccount/base.html [new file with mode: 0644]
wolnelektury/templates/socialaccount/snippets/provider_list.html

diff --git a/apps/ajaxable/templatetags/__init__.py b/apps/ajaxable/templatetags/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/ajaxable/templatetags/ajaxable_tags.py b/apps/ajaxable/templatetags/ajaxable_tags.py
new file mode 100644 (file)
index 0000000..2f9a8c4
--- /dev/null
@@ -0,0 +1,7 @@
+from django import template
+from ajaxable.utils import placeholdized
+register = template.Library()
+
+@register.filter
+def placeholdize(form):
+    return placeholdized(form)
index ecb07cc..bf8bb43 100644 (file)
@@ -12,6 +12,7 @@ django-allauth
 
 python-memcached
 piwik
 
 python-memcached
 piwik
+python-fb
 
 # Feedparser 
 Feedparser>=4.1
 
 # Feedparser 
 Feedparser>=4.1
diff --git a/wolnelektury/static/img/auth/facebook.png b/wolnelektury/static/img/auth/facebook.png
new file mode 100644 (file)
index 0000000..f9b6e71
Binary files /dev/null and b/wolnelektury/static/img/auth/facebook.png differ
diff --git a/wolnelektury/static/img/auth/google-icon.png b/wolnelektury/static/img/auth/google-icon.png
deleted file mode 100644 (file)
index d16d531..0000000
Binary files a/wolnelektury/static/img/auth/google-icon.png and /dev/null differ
diff --git a/wolnelektury/static/img/auth/openid-large.png?1237615666 b/wolnelektury/static/img/auth/openid-large.png?1237615666
deleted file mode 100644 (file)
index 6094fff..0000000
Binary files a/wolnelektury/static/img/auth/openid-large.png?1237615666 and /dev/null differ
diff --git a/wolnelektury/static/img/auth/twitter.png b/wolnelektury/static/img/auth/twitter.png
new file mode 100644 (file)
index 0000000..d2a5502
Binary files /dev/null and b/wolnelektury/static/img/auth/twitter.png differ
index 086a47d..9b8750d 100755 (executable)
@@ -58,7 +58,7 @@
             $('body').append($window);
 
             $window.jqm({
             $('body').append($window);
 
             $window.jqm({
-                ajax: '/uzytkownicy/zaloguj-utworz/',
+                ajax: '/uzytkownicy/zaloguj-utworz/?next=' + escape(window.location),
                 ajaxText: '<p><img src="' + STATIC_URL + 'img/indicator.gif" alt="*"/> ' + gettext("Loading") + '</p>',
                 target: $('.target', $window)[0],
                 overlay: 60,
                 ajaxText: '<p><img src="' + STATIC_URL + 'img/indicator.gif" alt="*"/> ' + gettext("Loading") + '</p>',
                 target: $('.target', $window)[0],
                 overlay: 60,
index 553e873..ba5385a 100644 (file)
@@ -1,14 +1,17 @@
-{% extends "ajaxable/form.html" %}
 {% load i18n %}
 {% load i18n %}
+<h1>{{ title }}</h1>
 
 
-{% block extra %}
+<form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8"
+       class="cuteform{% if placeholdize %} hidelabels{% endif %}">
+<ol>
+    <div id="id_{% if form_prefix %}{{ form_prefix }}-{% endif %}__all__"></div>
+    {{ form.as_ul }}
+    <li><a href="{% url account_reset_password %}">{% trans "Forgot your password?" %}</a></li>
+    <li><input type="submit" value="{{ submit }}"/></li>
+</ol>
+</form>
 
 
-<h2>{% trans "or join accounts:" %}</h2>
+<h1>{% trans "or merge accounts:" %}</h1>
 
 
-<ul class="socialauth">
 {% include "socialaccount/snippets/provider_list.html" %}
 {% include "socialaccount/snippets/provider_list.html" %}
-</ul>
-
-{% endblock %}
-
 
 
index 394902a..f879d46 100755 (executable)
@@ -1,14 +1,9 @@
-{% extends "ajaxable/form.html" %}
+{% extends "auth/login.html" %}
 {% load i18n %}
 
 {% block extra %}
 
 {% load i18n %}
 
 {% block extra %}
 
-<h2>{% trans "or join accounts:" %}</h2>
-
-<ul class="socialauth">
-{% include "socialaccount/snippets/provider_list.html" %}
-</ul>
-
+{{ block.super }}
 
 <h1>{% trans "or register" %}:</h1>
 
 
 <h1>{% trans "or register" %}:</h1>
 
diff --git a/wolnelektury/templates/openid/login.html b/wolnelektury/templates/openid/login.html
new file mode 100644 (file)
index 0000000..afe7fe8
--- /dev/null
@@ -0,0 +1,24 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+
+
+{% block titleextra %}{% trans "OpenID Sign In" %}{% endblock %}
+
+
+{% block body %}
+
+<h1>{% trans 'OpenID Sign In' %}</h1>
+
+
+<form class="cuteform hidelabels" method="post" action="{% url openid_login %}">
+<ul>
+       {% csrf_token %}
+       {% with form|placeholdize as f %}
+       {{ f.as_ul }}
+    {% endwith %}
+    <li><input type="submit" value='{% trans "Login" %}' /></li>
+</ul>
+</form>
+
+{% endblock %}
diff --git a/wolnelektury/templates/socialaccount/base.html b/wolnelektury/templates/socialaccount/base.html
new file mode 100644 (file)
index 0000000..94d9808
--- /dev/null
@@ -0,0 +1 @@
+{% extends "base.html" %}
index 99e30a5..45b740c 100644 (file)
@@ -1,21 +1,30 @@
 {% load allauth_tags %}
 {% load allauth_tags %}
+{% load catalogue_tags %}
 
 
+{% if allauth.facebook_enabled %}
+{% fbconnect %}
+{% endif %}
+
+<ul class="socialauth">
 {% if allauth.openid_enabled %}
 <li><a title="Google" class="socialaccount_provider google" href="{% openid_login_url openid="https://www.google.com/accounts/o8/id" %}">
        <img alt="Google" src="{{ STATIC_URL }}img/auth/google.png" /></a></li>
 {% endif %}
 {% if allauth.openid_enabled %}
 <li><a title="Google" class="socialaccount_provider google" href="{% openid_login_url openid="https://www.google.com/accounts/o8/id" %}">
        <img alt="Google" src="{{ STATIC_URL }}img/auth/google.png" /></a></li>
 {% endif %}
+{% if allauth.facebook_enabled %}
+<li><a title="Facebook" class="socialaccount_provider facebook" href="{% facebook_login_url next=request.GET.next|build_absolute_uri:request %}">
+       <img alt="Facebook" src="{{ STATIC_URL }}img/auth/facebook.png" /></a></li>
+{% endif %}
 {% if allauth.twitter_enabled %}
 <li><a title="Twitter" class="socialaccount_provider twitter" href="{% twitter_login_url %}">
        <img alt="Twitter" src="{{ STATIC_URL }}img/auth/twitter.png" /></a></li>
 {% endif %}
 {% if allauth.twitter_enabled %}
 <li><a title="Twitter" class="socialaccount_provider twitter" href="{% twitter_login_url %}">
        <img alt="Twitter" src="{{ STATIC_URL }}img/auth/twitter.png" /></a></li>
 {% endif %}
-{% if allauth.facebook_enabled %}
-<li><a title="Facebook" class="socialaccount_provider facebook" href="{% facebook_login_url %}">
-       <img alt="Facebook" src="{{ STATIC_URL }}img/auth/facebook.png" /></a></li>
-{% endif %}
 {% if allauth.openid_enabled %}
 {% if allauth.openid_enabled %}
+<!--li><a title="WP.pl" class="socialaccount_provider wppl" href="{% openid_login_url openid="http://openid.wp.pl" %}">
+       <img alt="WP.pl" src="{{ STATIC_URL }}img/auth/wppl.png" /></a></li-->
 <!--li><a title="Yahoo" class="socialaccount_provider yahoo" href="{% openid_login_url openid="http://me.yahoo.com" %}">
        <img alt="Yahoo" src="{{ STATIC_URL }}img/auth/yahoo.png" /></a></li-->
 <!--li><a title="Yahoo" class="socialaccount_provider yahoo" href="{% openid_login_url openid="http://me.yahoo.com" %}">
        <img alt="Yahoo" src="{{ STATIC_URL }}img/auth/yahoo.png" /></a></li-->
-<!--li><a title="OpenID" class="socialaccount_provider openid" href="{% openid_login_url %}">
-       <img alt="OpenID" src="{{ STATIC_URL }}img/auth/openid.png" /></a></li-->
+<li><a title="OpenID" class="socialaccount_provider openid" href="{% openid_login_url %}">
+       <img alt="OpenID" src="{{ STATIC_URL }}img/auth/openid.png" /></a></li>
 <!--li><a title="Hyves" class="socialaccount_provider hyves" href="{% openid_login_url openid="http://hyves.nl" %}">Hyves</a></li-->
 {% endif %}
 <!--li><a title="Hyves" class="socialaccount_provider hyves" href="{% openid_login_url openid="http://hyves.nl" %}">Hyves</a></li-->
 {% endif %}
+</ul>