]> git.parisson.com Git - telemeta.git/commitdiff
Fix various registration forms against django 1.6 (fix #30)
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 19 Feb 2015 10:17:11 +0000 (11:17 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 19 Feb 2015 10:17:11 +0000 (11:17 +0100)
example/sandbox/settings.py
telemeta/templates/telemeta/login.html
telemeta/templates/telemeta/profile_detail.html
telemeta/templates/telemeta/registration/password_change_done.html
telemeta/templates/telemeta/registration/password_change_form.html
telemeta/templates/telemeta/registration/password_reset_complete.html
telemeta/templates/telemeta/registration/password_reset_confirm.html
telemeta/templates/telemeta/registration/password_reset_done.html
telemeta/templates/telemeta/registration/password_reset_email.html
telemeta/templates/telemeta/registration/password_reset_form.html
telemeta/urls.py

index e94238293de671010b158891429e07915f90633a..4f469f5a49c337de0d11b980bb2b491446c2c05f 100644 (file)
@@ -148,6 +148,7 @@ INSTALLED_APPS = (
     'bootstrap3',
     'bootstrap_pagination',
     'googletools',
+    'registration',
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (
index 5fecb1335cffe2dbf0a88130dc375f872cbb0eea..e3b09896848182b906e11625d3dbf9aa65a75bce 100644 (file)
@@ -48,7 +48,7 @@ $(document).ready(function() {
 </a>
 
 <input type="hidden" name="next" value="{{ next }}" />
-<span><a href="{% url "telemeta-password-reset" %}">{% trans "Password forgotten" %} ?</a></span>
+<span><a href="{% url "password_reset" %}">{% trans "Password forgotten" %} ?</a></span>
 </p>
 
 </form>
index 16218314cf8bafa021a6a1143189b7d8ef316476..7a6df49e691a8f4746b601f0f312b2835e79230c 100644 (file)
@@ -72,7 +72,7 @@
     <a href="{% url "telemeta-profile-edit" usr.username %}" class="component_icon button icon_edit">{% trans "Edit" %}</a>
     {%  endif %}
     {% if user.is_authenticated and user.username == usr.username %}
-    <a href="{% url "telemeta-password-change" %}" class="component_icon button icon_login">{% trans "Change password" %}</a>
+    <a href="{% url "password_change" %}" class="component_icon button icon_login">{% trans "Change password" %}</a>
     {%  endif %}
 
   </div>
index fa3713748d77eaf1d4e885aeb0a47c5353ee5483..da277dfc8183ff57a37d20033c07d724c002160f 100644 (file)
@@ -1,11 +1,7 @@
-{% extends "telemeta/base.html" %}
+{% extends "telemeta/registration/registration_base.html" %}
 {% load i18n %}
-{% block userlinks %}{% url "django-admindocs-docroot" as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}{% trans 'Change password' %} / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
-
-{% block title %}<br />{% trans 'Password change successful' %}{% endblock %}
-
+{% block title %}{% trans "Password changed" %}{% endblock %}
 {% block content %}
-
-<p>{% trans 'Your password was changed.' %}</p>
-
+{% trans "Password successfully changed!" %}
 {% endblock %}
+
index dd9b9259e637a682913a866aa482f68bd9d1c2ac..889bf932a868f22d9938c54e98ae5117b2e12cad 100644 (file)
@@ -1,49 +1,18 @@
-{% extends "telemeta/base.html" %}
-{% load i18n adminmedia %}
-{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
-{% block userlinks %}{% url "django-admindocs-docroot" as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %} {% trans 'Change password' %} / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
-
-{% block title %}<br />{% trans 'Password change' %}{% endblock %}
-
-{% block content %}<div id="content-main">
-
-<form id="password_change" action="" method="post">{% csrf_token %}
-<div>
-{% if form.errors %}
-    <p class="errornote">
-    {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
-    </p>
-{% endif %}
-
-<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
-
-<fieldset class="aligned wide">
-
-<div class="form-row">
-    {{ form.old_password.errors }}
-    <label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }}
-</div>
-
-<div class="form-row">
-    {{ form.new_password1.errors }}
-    <label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }}
-</div>
-
-<div class="form-row">
-{{ form.new_password2.errors }}
-    <label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }}
-</div>
-
-</fieldset>
-
-<br />
-<div class="submit-row">
-   <a href="#" class="component_icon button icon_save"
-   onclick="document.getElementById('password_change').submit(); return false;">{% trans 'Change my password' %}</a>
-</div>
-
-<script type="text/javascript">document.getElementById("id_old_password").focus();</script>
-</div>
-</form></div>
-
+{% extends "telemeta/registration/registration_base.html" %}
+{% load i18n %}
+{% block title %}{% trans "Change password" %}{% endblock %}
+{% block content %}
+<form method='post' id="_loginForm" action=''>{% csrf_token %}
+<table>
+    {{ form }}
+    <tr><td></td><td><br>
+
+    <a href="#" onclick="$('#_loginForm').submit();" style="float: left;">
+      <button type="button" class="btn btn-default">
+        <span class="glyphicon glyphicon-log-in"></span> {% trans "Change password" %}
+      </button>
+    </a>
+
+</table>
+</form>
 {% endblock %}
index d8b0dd85d988fd46022cf3d2b5eed30688ad3416..4b80c01ed9359ce4cba05b11fa979b36d52f39f1 100644 (file)
@@ -1,11 +1,6 @@
-{% extends "telemeta/base.html" %}
+{% extends "telemeta/registration/registration_base.html" %}
 {% load i18n %}
-
-{% block title %}<br />{% trans 'Password reset complete' %}{% endblock %}
-
-{% block content %}
-<p>{% trans "Your password has been set.  You may go ahead and log in now." %}</p>
-
-<br />
-<p><a href="{{ login_url }}" class="component_icon button icon_login">{% trans "Log in" %}</a></p>
-{% endblock %}
+{% block title %}{% trans "Password reset complete" %}{% endblock %}
+{% block content %}{% blocktrans %}
+Your password has been reset!  You may now <a href="{{ login_url }}">log in</a>.
+{% endblocktrans %}{% endblock %}
index c98cb715596c0f3f689327b56c1f5de90907ad0e..dfe4efc7b46d1801e4dec3685cb0c6f65327945b 100644 (file)
@@ -1,28 +1,12 @@
-{% extends "telemeta/base.html" %}
+{% extends "telemeta/registration/registration_base.html" %}
 {% load i18n %}
-
-{% block title %}<br />{% trans 'Password reset' %}{% endblock %}
-
+{% block title %}{% trans "Confirm password reset" %}{% endblock %}
 {% block content %}
-{% if validlink %}
-<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
-
-<br />
-
-<form id="password_confirm" action="" method="post">{% csrf_token %}
-<table><tr>
-<td>{{ form.new_password1.errors }}<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label></td><td>{{ form.new_password1 }}</p></td></tr>
-<tr><td>{{ form.new_password2.errors }}
-<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label></td><td>{{ form.new_password2 }}</p></td>
-</tr></table>
-
-<br /><br />
-<p><a href="#" class="component_icon button icon_save" onclick="document.getElementById('password_confirm').submit(); return false;">{% trans 'Change my password' %}</a></p>
+{% trans "Enter your new password below to reset your password:" %}
+<form method="post" action="">{% csrf_token %}
+<table>
+    {{ form.as_table }}
+    <tr><td></td><td><input type="submit" value="{% trans "Set password" %}"/></td></tr>
+</table>
 </form>
-
-{% else %}
-<h1>{% trans 'Password reset unsuccessful' %}</h1>
-<p>{% trans "The password reset link was invalid, possibly because it has already been used.  Please request a new password reset." %}</p>
-
-{% endif %}
 {% endblock %}
index 91ea6a9a197e5599da599717459be355145cba34..f61b65bc8fd0cc20046a0f03066c1345d85d4a55 100644 (file)
@@ -1,8 +1,9 @@
-{% extends "telemeta/base.html" %}
+{% extends "telemeta/registration/registration_base.html" %}
 {% load i18n %}
-
-{% block title %}<br />{% trans "Password reset successful" %}{% endblock %}
-
+{% block title %}{% trans "Password reset" %}{% endblock %}
 {% block content %}
-<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p>
+<p>
+{% blocktrans %}We have sent you an email with a link to reset your password.
+Please check your email and click the link to continue.{% endblocktrans %}
+</p>
 {% endblock %}
index e7fbaceb5f3b50b9d6a67ff01d3ae2ccbef4f2bc..287737fbaad4aac14fccef548d5e2c0ba00fc73e 100644 (file)
@@ -1,15 +1,17 @@
-{% load telemeta_utils %}{% load i18n %}{% autoescape off %}{% trans "Hello" %},
+{% load i18n %}{% trans "Greetings" %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %},
 
-{% trans "You're receiving this e-mail because you requested a password reset" %}
-{% blocktrans %}for your user account at {{ site_name }}{% endblocktrans %}.
+{% blocktrans %}You are receiving this email because you (or someone pretending to be you)
+requested that your password be reset on the {{ domain }} site.  If you do not 
+wish to reset your password, please ignore this message.
 
-{% trans "Please go to the following page and choose a new password:" %}
-{% block reset_link %}
-{{ protocol }}://{{ domain }}{% url "telemeta-password-reset-confirm" uidb36=uid token=token %}
-{% endblock %}
-{% trans "Your username, in case you've forgotten:" %} {{ user.username }}
+To reset your password, please click the following link, or copy and paste it
+into your web browser:{% endblocktrans %}
 
-{% trans "Best regards" %},
-{% trans "The site administrator" %} {% trans "of the" %} {% organization %}
+{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %}
 
-{% endautoescape %}
+{% blocktrans with username=user.username %}
+Your username, in case you've forgotten: {{ username }}
+
+Best regards,
+{{ site_name }} Management
+{% endblocktrans %}
\ No newline at end of file
index 6da1b8472812dcd8ded5ab5d9ce44d1b09b4026c..31c27e798e579b62a9bcfd12384bd8ae58e506ab 100644 (file)
@@ -1,13 +1,22 @@
-{% extends "telemeta/base.html" %}
+{% extends "telemeta/registration/registration_base.html" %}
 {% load i18n %}
+{% block title %}{% trans "Reset password" %}{% endblock %}
+{% block content %}{% blocktrans %}
+Forgot your password?  Enter your email in the form below and we'll send you
+instructions for creating a new one.{% endblocktrans %}
+<br><br>
+<form method='post' id="_loginForm" action=''>{% csrf_token %}
+<table>
+    {{ form }}
+    <tr><td></td><td><br>
+    <a href="#" onclick="$('#_loginForm').submit();" style="float: left;">
+      <button type="button" class="btn btn-default">
+        <span class="glyphicon glyphicon-log-in"></span> {% trans "Reset password" %}
+      </button>
+    </a>
 
-{% block title %}<br />{% trans "Password reset" %}{% endblock %}
 
-{% block content %}
-<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p>
-
-<form id="password_reset" action="" method="post">{% csrf_token %}
-{{ form.email.errors }}
-<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <a href="#" class="component_icon button icon_ok" onclick="document.getElementById('password_reset').submit(); return false;">{% trans 'Reset my password' %}</a></p>
+    </td></tr>
+</table>
 </form>
 {% endblock %}
index 0ca8eb2494ee7337824c171af24dd07168b5048d..8550588b4ef74f1240eec4718968ce3c606f3a05 100644 (file)
@@ -208,14 +208,12 @@ urlpatterns = patterns('',
     url(r'^accounts/(?P<username>[A-Za-z0-9._-]+)/rss/$', UserRevisionsFeed(),  name="telemeta-user-rss"),
 
     # Registration
-    url(r'^accounts/password_change/$', 'django.contrib.auth.views.password_change', {'template_name': 'telemeta/registration/password_change_form.html'}, name="telemeta-password-change"),
-    url(r'^accounts/password_change_done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'telemeta/registration/password_change_done.html'}, name="telemeta-password-change-done"),
-
-    url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'telemeta/registration/password_reset_form.html', 'email_template_name': 'telemeta/registration/password_reset_email.html'}, name="telemeta-password-reset"),
-    url(r'^accounts/password_reset_done/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'telemeta/registration/password_reset_done.html'}, name="telemeta-password-reset-done"),
-    url(r'^accounts/password_reset_confirm/(?P<uidb36>[A-Za-z0-9._-]+)/(?P<token>[A-Za-z0-9._-]+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name': 'telemeta/registration/password_reset_confirm.html'}, name="telemeta-password-reset-confirm"),
-    url(r'^accounts/password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'telemeta/registration/password_reset_complete.html'}, name="telemeta-password-reset-complete"),
-    url(r'^accounts/password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'telemeta/registration/password_reset_complete.html'}, name="telemeta-password-reset-complete"),
+    url(r'^accounts/password_change/$', 'django.contrib.auth.views.password_change', {'template_name': 'telemeta/registration/password_change_form.html'}, name="password_change"),
+    url(r'^accounts/password_change_done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'telemeta/registration/password_change_done.html'}, name="password_change_done"),
+    url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'telemeta/registration/password_reset_form.html', 'email_template_name': 'registration/password_reset_email.html'}, name="password_reset"),
+    url(r'^accounts/password_reset_done/$', 'django.contrib.auth.views.password_reset_done', {'template_name': 'telemeta/registration/password_reset_done.html'}, name="password_reset_done"),
+    url(r'^accounts/password_reset_confirm/(?P<uidb36>[A-Za-z0-9._-]+)/(?P<token>[A-Za-z0-9._-]+)/$', 'django.contrib.auth.views.password_reset_confirm', {'template_name': 'telemeta/registration/password_reset_confirm.html'}, name="password_reset_confirm"),
+    url(r'^accounts/password_reset_complete/$', 'django.contrib.auth.views.password_reset_complete', {'template_name': 'telemeta/registration/password_reset_complete.html'}, name="password_reset_complete"),
 
     # JSON RPC
     url(r'json/$', jsonrpc_site.dispatch, name='jsonrpc_mountpoint'),