From: Radek Czajka Date: Fri, 9 Mar 2012 13:46:22 +0000 (+0100) Subject: minimal allauth support X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/23025f539214ffbd82a597d4a1d70808d6e59f31?hp=f88f26e37b7f97e31ff75742eecd21d7f3fe4f16 minimal allauth support --- diff --git a/requirements.txt b/requirements.txt index a961c4d32..ecb07cca2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,7 @@ django-rosetta>=0.5.3 django-maintenancemode>=0.9 django-piston django-jsonfield +django-allauth python-memcached piwik diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index 07b1ef004..7f22b0ce6 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -92,6 +92,8 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'wolnelektury.context_processors.extra_settings', 'search.context_processors.search_form', + "allauth.context_processors.allauth", + "allauth.account.context_processors.account", ) MIDDLEWARE_CLASSES = [ @@ -114,6 +116,12 @@ TEMPLATE_DIRS = [ path.join(PROJECT_DIR, 'templates'), ] + +AUTHENTICATION_BACKENDS = [ + 'django.contrib.auth.backends.ModelBackend', + 'allauth.account.auth_backends.AuthenticationBackend', +] +EMAIL_CONFIRMATION_DAYS = 2 LOGIN_URL = '/uzytkownicy/zaloguj/' LOGIN_REDIRECT_URL = '/' @@ -136,6 +144,16 @@ INSTALLED_APPS = [ 'djkombu', # 'django_nose', + #allauth stuff + 'emailconfirmation', + 'uni_form', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.openid', + #'allauth.facebook', + #'allauth.twitter', + # included 'compress', 'modeltranslation', diff --git a/wolnelektury/static/css/dialogs.css b/wolnelektury/static/css/dialogs.css index d83116ba6..803c14d39 100755 --- a/wolnelektury/static/css/dialogs.css +++ b/wolnelektury/static/css/dialogs.css @@ -115,3 +115,14 @@ #custom-pdf-window label { display: inline; } + + +.socialauth { + margin: 1em 0; + padding: 0; +} +.socialauth li { + display: inline; + list-style: none; + margin-right: 1em; +} diff --git a/wolnelektury/static/img/auth/google-icon.png b/wolnelektury/static/img/auth/google-icon.png new file mode 100644 index 000000000..d16d5313e Binary files /dev/null and b/wolnelektury/static/img/auth/google-icon.png differ diff --git a/wolnelektury/static/img/auth/google.png b/wolnelektury/static/img/auth/google.png new file mode 100644 index 000000000..bf7d11240 Binary files /dev/null and b/wolnelektury/static/img/auth/google.png differ diff --git a/wolnelektury/static/img/auth/openid-large.png?1237615666 b/wolnelektury/static/img/auth/openid-large.png?1237615666 new file mode 100644 index 000000000..6094fffec Binary files /dev/null and b/wolnelektury/static/img/auth/openid-large.png?1237615666 differ diff --git a/wolnelektury/static/img/auth/openid.png b/wolnelektury/static/img/auth/openid.png new file mode 100644 index 000000000..83e97691f Binary files /dev/null and b/wolnelektury/static/img/auth/openid.png differ diff --git a/wolnelektury/templates/auth/login.html b/wolnelektury/templates/auth/login.html new file mode 100644 index 000000000..553e873a0 --- /dev/null +++ b/wolnelektury/templates/auth/login.html @@ -0,0 +1,14 @@ +{% extends "ajaxable/form.html" %} +{% load i18n %} + +{% block extra %} + +

{% trans "or join accounts:" %}

+ + + +{% endblock %} + + diff --git a/wolnelektury/templates/auth/login_register.html b/wolnelektury/templates/auth/login_register.html index ecaeaf4a1..394902a2b 100755 --- a/wolnelektury/templates/auth/login_register.html +++ b/wolnelektury/templates/auth/login_register.html @@ -3,6 +3,12 @@ {% block extra %} +

{% trans "or join accounts:" %}

+ + +

{% trans "or register" %}:

diff --git a/wolnelektury/templates/socialaccount/snippets/provider_list.html b/wolnelektury/templates/socialaccount/snippets/provider_list.html new file mode 100644 index 000000000..99e30a5c1 --- /dev/null +++ b/wolnelektury/templates/socialaccount/snippets/provider_list.html @@ -0,0 +1,21 @@ +{% load allauth_tags %} + +{% if allauth.openid_enabled %} +
  • + Google
  • +{% endif %} +{% if allauth.twitter_enabled %} +
  • +{% endif %} +{% if allauth.facebook_enabled %} +
  • +{% endif %} +{% if allauth.openid_enabled %} + + + +{% endif %} diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index f6cd8d927..36959904c 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -32,6 +32,7 @@ urlpatterns += patterns('', url(r'^raporty/', include('reporting.urls')), url(r'^info/', include('infopages.urls')), url(r'^ludzie/', include('social.urls')), + url(r'^uzytkownicy/', include('allauth.urls')), # Admin panel url(r'^admin/catalogue/book/import$', 'catalogue.views.import_book', name='import_book'), diff --git a/wolnelektury/views.py b/wolnelektury/views.py index c2624793b..bcead0317 100755 --- a/wolnelektury/views.py +++ b/wolnelektury/views.py @@ -27,6 +27,7 @@ def main_page(request): class LoginFormView(AjaxableFormView): form_class = AuthenticationForm + template = "auth/login.html" placeholdize = True title = _('Sign in') submit = _('Sign in')