From: Radek Czajka Date: Mon, 12 Mar 2012 15:51:48 +0000 (+0100) Subject: user settings X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/8139f82c719f4a041b18fd445026b8cf78aca4a6?ds=inline;hp=-c user settings --- 8139f82c719f4a041b18fd445026b8cf78aca4a6 diff --git a/apps/ajaxable/templatetags/ajaxable_tags.py b/apps/ajaxable/templatetags/ajaxable_tags.py index 2f9a8c4c8..229047891 100644 --- a/apps/ajaxable/templatetags/ajaxable_tags.py +++ b/apps/ajaxable/templatetags/ajaxable_tags.py @@ -2,6 +2,12 @@ from django import template from ajaxable.utils import placeholdized register = template.Library() + @register.filter def placeholdize(form): return placeholdized(form) + + +@register.filter +def placeholdized_ul(form): + return placeholdized(form).as_ul() diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index e4cb32bb8..599e7fb08 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -108,6 +108,7 @@ MIDDLEWARE_CLASSES = [ 'maintenancemode.middleware.MaintenanceModeMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.cache.FetchFromCacheMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', ] ROOT_URLCONF = 'wolnelektury.urls' @@ -122,7 +123,7 @@ AUTHENTICATION_BACKENDS = [ 'allauth.account.auth_backends.AuthenticationBackend', ] EMAIL_CONFIRMATION_DAYS = 2 -LOGIN_URL = '/uzytkownicy/zaloguj/' +LOGIN_URL = '/uzytkownik/login/' LOGIN_REDIRECT_URL = '/' diff --git a/wolnelektury/static/css/base.css b/wolnelektury/static/css/base.css index 3160611e5..54675a51e 100755 --- a/wolnelektury/static/css/base.css +++ b/wolnelektury/static/css/base.css @@ -143,6 +143,7 @@ h2 { } .hidden-box { position: absolute; + left: 0; display: none; border: 1px solid #ddd; padding: 1em 1em .5em 1em; diff --git a/wolnelektury/static/css/header.css b/wolnelektury/static/css/header.css index 39d4160c5..320fa8931 100755 --- a/wolnelektury/static/css/header.css +++ b/wolnelektury/static/css/header.css @@ -234,3 +234,14 @@ a.menu span { line-height: 1.636em; } + + + +#user-menu { + left: 0; + top: 2em; + width: 15em; +} +#user-menu a { + color: #0D7E85; +} diff --git a/wolnelektury/static/js/dialogs.js b/wolnelektury/static/js/dialogs.js index 9b8750d0c..d44dab32e 100755 --- a/wolnelektury/static/js/dialogs.js +++ b/wolnelektury/static/js/dialogs.js @@ -58,7 +58,7 @@ $('body').append($window); $window.jqm({ - ajax: '/uzytkownicy/zaloguj-utworz/?next=' + escape(window.location), + ajax: '/uzytkownik/zaloguj-utworz/?next=' + escape(window.location), ajaxText: '

* ' + gettext("Loading") + '

', target: $('.target', $window)[0], overlay: 60, diff --git a/wolnelektury/templates/account/email.html b/wolnelektury/templates/account/email.html new file mode 100644 index 000000000..1f0710bad --- /dev/null +++ b/wolnelektury/templates/account/email.html @@ -0,0 +1,65 @@ +{% extends "account/base.html" %} +{% load i18n %} +{% load ajaxable_tags %} + +{% block titleextra %}{% trans "Account" %}{% endblock %} + +{% block body %} +

{% trans "E-mail Addresses" %}

+ +{% if user.emailaddress_set.all %} +

{% trans 'The following e-mail addresses are associated to your account:' %}

+ +
+{% csrf_token %} + {% for emailaddress in user.emailaddress_set.all %} + +{% endfor %} + +
+ + + +
+
+ +{% else %} +

{% trans 'Warning:'%} {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}

+{% endif %} + + +

{% trans "Add E-mail Address" %}

+ +
+ +
+ +{% endblock %} + + +{% block extrabody %} + +{% endblock %} diff --git a/wolnelektury/templates/account/password_change.html b/wolnelektury/templates/account/password_change.html new file mode 100644 index 000000000..6abc0a9e0 --- /dev/null +++ b/wolnelektury/templates/account/password_change.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} +{% load ajaxable_tags %} + +{% block titleextra %}{% trans "Change Password" %}{% endblock %} + +{% block body %} +

{% trans "Change Password" %}

+ +
+ {% csrf_token %} + +
+{% endblock %} diff --git a/wolnelektury/templates/account/password_reset.html b/wolnelektury/templates/account/password_reset.html new file mode 100644 index 000000000..9a8bc1975 --- /dev/null +++ b/wolnelektury/templates/account/password_reset.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% load i18n %} +{% load ajaxable_tags %} +{% load account_tags %} + +{% block titleextra %}{% trans "Password Reset" %}{% endblock %} + +{% block body %} + +

{% trans "Password Reset" %}

+

{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

+ +
+ {% csrf_token %} + +
+{% endblock %} diff --git a/wolnelektury/templates/account/password_reset_done.html b/wolnelektury/templates/account/password_reset_done.html new file mode 100644 index 000000000..9447109de --- /dev/null +++ b/wolnelektury/templates/account/password_reset_done.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block titleextra %}{% trans "Password Reset" %}{% endblock %} + +{% block body %} +

{% trans "Password Reset" %}

+

{% trans "We have sent you an e-mail. You should receive it within a few minutes." %}

+{% endblock %} diff --git a/wolnelektury/templates/account/password_reset_from_key.html b/wolnelektury/templates/account/password_reset_from_key.html new file mode 100644 index 000000000..5cdd68e3a --- /dev/null +++ b/wolnelektury/templates/account/password_reset_from_key.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% load i18n %} +{% load ajaxable_tags %} + +{% block titleextra %}{% trans "Change Password" %}{% endblock %} + +{% block body %} +

{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

+ + {% if token_fail %} + {% url account_reset_password as passwd_reset_url %} +

{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a new password reset.{% endblocktrans %}

+ {% else %} + {% if form %} +
+ {% csrf_token %} + +
+ {% else %} +

{% trans 'Your password is now changed.' %}

+ {% endif %} + {% endif %} +{% endblock %} diff --git a/wolnelektury/templates/account/password_reset_key_message.txt b/wolnelektury/templates/account/password_reset_key_message.txt new file mode 100644 index 000000000..23db17a57 --- /dev/null +++ b/wolnelektury/templates/account/password_reset_key_message.txt @@ -0,0 +1,9 @@ +{% load i18n %}{% blocktrans with site.domain as site_domain and user.username as username %}You're receiving this e-mail because you or someone else has requested a password for your user account at {{site_domain}}. +It can be safely ignored if you did not request a password reset. Click the link below to reset your password. + +{{password_reset_url}} + +In case you forgot, your username is {{username}}. + +Thanks for using our site! +{% endblocktrans %} \ No newline at end of file diff --git a/wolnelektury/templates/account/password_set.html b/wolnelektury/templates/account/password_set.html new file mode 100644 index 000000000..d061a46e4 --- /dev/null +++ b/wolnelektury/templates/account/password_set.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} +{% load ajaxable_tags %} + +{% block head_title %}{% trans "Set Password" %}{% endblock %} + +{% block body %} +

{% trans "Set Password" %}

+ +
+ {% csrf_token %} + +
+{% endblock %} \ No newline at end of file diff --git a/wolnelektury/templates/emailconfirmation/confirm_email.html b/wolnelektury/templates/emailconfirmation/confirm_email.html new file mode 100644 index 000000000..0b74c11ff --- /dev/null +++ b/wolnelektury/templates/emailconfirmation/confirm_email.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block titleextra %}{% trans "E-mail Address Confirmation" %}{% endblock %} + +{% block body %} +

{% trans "E-mail Address Confirmation" %}

+ {% if email_address %} +

{% blocktrans with email_address.email as email and email_address.user as user %}You have confirmed that {{ email }} is an e-mail address for user '{{ user }}'.{% endblocktrans %}

+ {% else %} +

{% trans "Invalid confirmation key." %}

+ {% endif %} +{% endblock %} \ No newline at end of file diff --git a/wolnelektury/templates/openid/login.html b/wolnelektury/templates/openid/login.html index afe7fe8f4..47413977f 100644 --- a/wolnelektury/templates/openid/login.html +++ b/wolnelektury/templates/openid/login.html @@ -14,9 +14,7 @@
diff --git a/wolnelektury/templates/superbase.html b/wolnelektury/templates/superbase.html index 5813a2b7f..fade57b9e 100644 --- a/wolnelektury/templates/superbase.html +++ b/wolnelektury/templates/superbase.html @@ -60,7 +60,17 @@

{% if user.is_authenticated %} - {% trans "Welcome" %}, {{ user.username }} + {% trans "Welcome" %}, + + + {{ user.username }} + + + {% trans "Password" %}
+ {% trans "E-mail" %}
+ {% trans "Social accounts" %}
+
+
| {% trans "My shelf" %} {% if user.is_staff %} | {% trans "Administration" %} @@ -197,5 +207,8 @@ var pageTracker = _gat._getTracker("UA-2576694-1"); pageTracker._trackPageview(); --> + + {% block extrabody %} + {% endblock %} diff --git a/wolnelektury/templates/user.html b/wolnelektury/templates/user.html new file mode 100644 index 000000000..1d1503386 --- /dev/null +++ b/wolnelektury/templates/user.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load i18n %} + + +{% block titleextra %}{% trans "User" %}{% endblock %} + +{% block body %} + +

{% trans "User" %}

+ +
+

{% trans "Password" %}

+

{% trans "E-mail" %}

+

{% trans "Social accounts" %}

+
+ +{% endblock %} diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index 36959904c..3806b73ce 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -16,10 +16,11 @@ urlpatterns = patterns('wolnelektury.views', url(r'^zegar/$', 'clock', name='clock'), # Authentication - url(r'^uzytkownicy/zaloguj/$', views.LoginFormView(), name='login'), - url(r'^uzytkownicy/utworz/$', views.RegisterFormView(), name='register'), - url(r'^uzytkownicy/wyloguj/$', 'logout_then_redirect', name='logout'), - url(r'^uzytkownicy/zaloguj-utworz/$', views.LoginRegisterFormView(), name='login_register'), + url(r'^uzytkownik/$', 'user_settings', name='user_settings'), + url(r'^uzytkownik/login/$', views.LoginFormView(), name='login'), + url(r'^uzytkownik/signup/$', views.RegisterFormView(), name='register'), + url(r'^uzytkownik/logout/$', 'logout_then_redirect', name='logout'), + url(r'^uzytkownik/zaloguj-utworz/$', views.LoginRegisterFormView(), name='login_register'), ) urlpatterns += patterns('', @@ -32,7 +33,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')), + url(r'^uzytkownik/', 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 bcead0317..cb1d2af96 100755 --- a/wolnelektury/views.py +++ b/wolnelektury/views.py @@ -2,6 +2,7 @@ from datetime import datetime import feedparser from django.contrib import auth +from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import UserCreationForm, AuthenticationForm from django.core.cache import cache from django.http import HttpResponse, HttpResponseRedirect @@ -108,3 +109,9 @@ def publish_plan(request): return render_to_response("publish_plan.html", {'plan': plan}, context_instance=RequestContext(request)) + + +@login_required +def user_settings(request): + return render_to_response("user.html", + context_instance=RequestContext(request))