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()
'maintenancemode.middleware.MaintenanceModeMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
]
ROOT_URLCONF = 'wolnelektury.urls'
'allauth.account.auth_backends.AuthenticationBackend',
]
EMAIL_CONFIRMATION_DAYS = 2
-LOGIN_URL = '/uzytkownicy/zaloguj/'
+LOGIN_URL = '/uzytkownik/login/'
LOGIN_REDIRECT_URL = '/'
}
.hidden-box {
position: absolute;
+ left: 0;
display: none;
border: 1px solid #ddd;
padding: 1em 1em .5em 1em;
line-height: 1.636em;
}
+
+
+
+#user-menu {
+ left: 0;
+ top: 2em;
+ width: 15em;
+}
+#user-menu a {
+ color: #0D7E85;
+}
$('body').append($window);
$window.jqm({
- ajax: '/uzytkownicy/zaloguj-utworz/?next=' + escape(window.location),
+ ajax: '/uzytkownik/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,
--- /dev/null
+{% extends "account/base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+
+{% block titleextra %}{% trans "Account" %}{% endblock %}
+
+{% block body %}
+ <h1>{% trans "E-mail Addresses" %}</h1>
+
+{% if user.emailaddress_set.all %}
+<p class="normal-text">{% trans 'The following e-mail addresses are associated to your account:' %}</p>
+
+<form action="{% url account_email %}" class="cuteform" method="post">
+{% csrf_token %}
+ {% for emailaddress in user.emailaddress_set.all %}
+ <label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
+ <input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary %}checked="checked"{%endif %} value="{{emailaddress.email}}"/>
+
+{{ emailaddress.email }}
+ {% if emailaddress.verified %}
+ <span class="verified">{% trans "Verified" %}</span>
+ {% else %}
+ <span class="unverified">{% trans "Unverified" %}</span>
+ {% endif %}
+ {% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
+</label>
+{% endfor %}
+
+<div style="margin-top:1em;">
+ <button class="secondaryAction" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
+ <button class="secondaryAction" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
+ <button class="primaryAction" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
+</div>
+</form>
+
+{% else %}
+<p class="normal-text"><strong>{% trans 'Warning:'%}</strong> {% 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." %}</p>
+{% endif %}
+
+
+ <h1>{% trans "Add E-mail Address" %}</h1>
+
+ <form method="post" action="" class="cuteform hidelabels">
+ <ul>
+ {% csrf_token %}
+ {{ add_email_form|placeholdized_ul }}
+ <li><button name="action_add" type="submit">{% trans "Add E-mail" %}</button></li>
+ </ul>
+ </form>
+
+{% endblock %}
+
+
+{% block extrabody %}
+<script type="text/javascript">
+$(function(){
+$("button[name='action_remove']").click(function(){
+if (confirm("{% trans 'Do you really want to remove the selected e-mail address?' %}")) {
+return true;
+}
+return false;
+});
+});
+</script>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+
+{% block titleextra %}{% trans "Change Password" %}{% endblock %}
+
+{% block body %}
+ <h1>{% trans "Change Password" %}</h1>
+
+ <form method="POST" action="" class="cuteform hidelabels">
+ {% csrf_token %}
+ <ul>
+ {{ password_change_form|placeholdized_ul }}
+ <li><input type="submit" name="action" value="{% trans "Change Password" %}"/></li>
+ </ul>
+ </form>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+{% load account_tags %}
+
+{% block titleextra %}{% trans "Password Reset" %}{% endblock %}
+
+{% block body %}
+
+ <h1>{% trans "Password Reset" %}</h1>
+ <p class="normal-text">{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
+
+ <form method="POST" action="" class="cuteform hidelabels">
+ {% csrf_token %}
+ <ul>
+ {{ password_reset_form|placeholdized_ul }}
+ <li><input type="submit" value="{% trans "Reset My Password" %}" /></li>
+ </ul>
+ </form>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block titleextra %}{% trans "Password Reset" %}{% endblock %}
+
+{% block body %}
+ <h1>{% trans "Password Reset" %}</h1>
+ <p class="normal-text">{% trans "We have sent you an e-mail. You should receive it within a few minutes." %}</p>
+{% endblock %}
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+
+{% block titleextra %}{% trans "Change Password" %}{% endblock %}
+
+{% block body %}
+ <h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>
+
+ {% if token_fail %}
+ {% url account_reset_password as passwd_reset_url %}
+ <p class="normal-text">{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
+ {% else %}
+ {% if form %}
+ <form method="POST" action="" class="cuteform hidelabels">
+ {% csrf_token %}
+ <ul>
+ {{ form|placeholdized_ul }}
+ <li><input type="submit" name="action" value="{% trans "change password" %}"/></li>
+ </ul>
+ </form>
+ {% else %}
+ <p class="normal-text">{% trans 'Your password is now changed.' %}</p>
+ {% endif %}
+ {% endif %}
+{% endblock %}
--- /dev/null
+{% 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
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+{% load ajaxable_tags %}
+
+{% block head_title %}{% trans "Set Password" %}{% endblock %}
+
+{% block body %}
+ <h1>{% trans "Set Password" %}</h1>
+
+ <form method="POST" action="" class="cuteform hidelabels">
+ {% csrf_token %}
+ <ul>
+ {{ password_set_form|placeholdized_ul }}
+ <li><input type="submit" name="action" value="{% trans "Set Password" %}"/></li>
+ </ul>
+ </form>
+{% endblock %}
\ No newline at end of file
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block titleextra %}{% trans "E-mail Address Confirmation" %}{% endblock %}
+
+{% block body %}
+ <h1>{% trans "E-mail Address Confirmation" %}</h1>
+ {% if email_address %}
+ <p class="normal-text">{% blocktrans with email_address.email as email and email_address.user as user %}You have confirmed that <a href="mailto:{{email}}">{{ email }}</a> is an e-mail address for user '{{ user }}'.{% endblocktrans %}</p>
+ {% else %}
+ <p class="normal-text">{% trans "Invalid confirmation key." %}</p>
+ {% endif %}
+{% endblock %}
\ No newline at end of file
<form class="cuteform hidelabels" method="post" action="{% url openid_login %}">
<ul>
{% csrf_token %}
- {% with form|placeholdize as f %}
- {{ f.as_ul }}
- {% endwith %}
+ {{ form|placeholdized_ul }}
<li><input type="submit" value='{% trans "Login" %}' /></li>
</ul>
</form>
<p id="user-info" class="mono">
{% if user.is_authenticated %}
- {% trans "Welcome" %}, <strong>{{ user.username }}</strong>
+ {% trans "Welcome" %},
+ <span class="hidden-box-wrapper">
+ <a href="{% url user_settings %}" class="hidden-box-trigger">
+ <strong>{{ user.username }}</strong>
+ </a>
+ <span id="user-menu" class="hidden-box">
+ <a href="{% url account_set_password %}">{% trans "Password" %}</a><br/>
+ <a href="{% url account_email %}">{% trans "E-mail" %}</a><br/>
+ <a href="{% url socialaccount_connections %}">{% trans "Social accounts" %}</a><br/>
+ </span>
+ </span>
| <a href="{% url social_my_shelf %}" id="user-shelves-link">{% trans "My shelf" %}</a>
{% if user.is_staff %}
| <a href="/admin/">{% trans "Administration" %}</a>
var pageTracker = _gat._getTracker("UA-2576694-1");
pageTracker._trackPageview();
</script>-->
+
+ {% block extrabody %}
+ {% endblock %}
</body>
</html>
--- /dev/null
+{% extends "base.html" %}
+{% load i18n %}
+
+
+{% block titleextra %}{% trans "User" %}{% endblock %}
+
+{% block body %}
+
+<h1>{% trans "User" %}</h1>
+
+<div class='normal-text'>
+<p><a href="{% url account_set_password %}">{% trans "Password" %}</a></p>
+<p><a href="{% url account_email %}">{% trans "E-mail" %}</a></p>
+<p><a href="{% url socialaccount_connections %}">{% trans "Social accounts" %}</a></p>
+</div>
+
+{% endblock %}
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('',
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'),
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
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))