[extensions-web] Add password change and password reset functionality



commit fbeff09e7940ad3890f19843e3dbab4f64961433
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 26 17:47:58 2011 -0400

    Add password change and password reset functionality

 sweettooth/auth/templates/registration/login.html  |    3 +++
 .../registration/password_change_done.html         |    4 ++++
 .../registration/password_change_form.html         |   14 ++++++++++++++
 .../registration/password_reset_complete.html      |    5 +++++
 .../registration/password_reset_confirm.html       |   18 ++++++++++++++++++
 .../registration/password_reset_done.html          |    4 ++++
 .../registration/password_reset_email.html         |    7 +++++++
 .../registration/password_reset_form.html          |   14 ++++++++++++++
 .../auth/templates/registration/settings.html      |    7 +++++++
 sweettooth/auth/urls.py                            |    5 +++++
 sweettooth/templates/base.html                     |    2 +-
 11 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/auth/templates/registration/login.html b/sweettooth/auth/templates/registration/login.html
index 7570033..55f868a 100644
--- a/sweettooth/auth/templates/registration/login.html
+++ b/sweettooth/auth/templates/registration/login.html
@@ -26,4 +26,7 @@
     </li>
   </ol>
 </form>
+
+<a href="{% url registration_register %}">Register</a>
+<a href="{% url auth_password_reset %}">Forgot your password?</a>
 {% endblock %}
diff --git a/sweettooth/auth/templates/registration/password_change_done.html b/sweettooth/auth/templates/registration/password_change_done.html
new file mode 100644
index 0000000..3c943bd
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_change_done.html
@@ -0,0 +1,4 @@
+{% extends "base.html" %}
+{% block body %}
+<p>Your password was successfully changed.</p>
+{% endblock %}
diff --git a/sweettooth/auth/templates/registration/password_change_form.html b/sweettooth/auth/templates/registration/password_change_form.html
new file mode 100644
index 0000000..bb7aad4
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_change_form.html
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+{% block body %}
+<h3>Change your password</h3>
+<form action="" method="POST">
+  {% csrf_token %}
+  <ol>
+    {{ form.as_ul }}
+
+    <li class="submit">
+      <input type="submit" value="Change password">
+    </li>
+  </ol>
+</form>
+{% endblock %}
diff --git a/sweettooth/auth/templates/registration/password_reset_complete.html b/sweettooth/auth/templates/registration/password_reset_complete.html
new file mode 100644
index 0000000..575bc27
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_reset_complete.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block body %}
+<p>You have now changed your password.</p>
+{% endblock %}
+
diff --git a/sweettooth/auth/templates/registration/password_reset_confirm.html b/sweettooth/auth/templates/registration/password_reset_confirm.html
new file mode 100644
index 0000000..86ef87c
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_reset_confirm.html
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+{% block body %}
+{% if validlink %}
+<h3> Password reset </h3>
+<form action="" method="POST">
+  {% csrf_token %}
+  <ol>
+    {{ form.as_ul }}
+
+    <li class="submit">
+      <input type="submit" value="Reset your password">
+    </li>
+  </ol>
+</form>
+{% else %}
+<p>The token for the password reset is incorrect. Please check your link and try again.</p>
+{% endif %}
+{% endblock %}
diff --git a/sweettooth/auth/templates/registration/password_reset_done.html b/sweettooth/auth/templates/registration/password_reset_done.html
new file mode 100644
index 0000000..9268ff0
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_reset_done.html
@@ -0,0 +1,4 @@
+{% extends "base.html" %}
+{% block body %}
+<p>An email was sent to your account allowing you to reset your password.</p>
+%{ endblock %}
diff --git a/sweettooth/auth/templates/registration/password_reset_email.html b/sweettooth/auth/templates/registration/password_reset_email.html
new file mode 100644
index 0000000..f44d11a
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_reset_email.html
@@ -0,0 +1,7 @@
+You have requested a password reset on {{ site_name }}. Please follow the link
+to reset your password.
+
+  https://extensions.gnome.org/accounts/password/reset/confirm/{{ token }}/
+
+Thanks!
+  the GNOME Shell Extensions team
diff --git a/sweettooth/auth/templates/registration/password_reset_form.html b/sweettooth/auth/templates/registration/password_reset_form.html
new file mode 100644
index 0000000..8c2921c
--- /dev/null
+++ b/sweettooth/auth/templates/registration/password_reset_form.html
@@ -0,0 +1,14 @@
+{% extends "base.html" %}
+{% block body %}
+<h3> Password reset </h3>
+<form action="" method="POST">
+  {% csrf_token %}
+  <ol>
+    {{ form.as_ul }}
+
+    <li class="submit">
+      <input type="submit" value="Reset your password">
+    </li>
+  </ol>
+</form>
+{% endblock %}
diff --git a/sweettooth/auth/templates/registration/settings.html b/sweettooth/auth/templates/registration/settings.html
new file mode 100644
index 0000000..b64f7fb
--- /dev/null
+++ b/sweettooth/auth/templates/registration/settings.html
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+{% block body %}
+  <h3> Settings </h3>
+  <ul>
+    <li> <a href="{% url auth_password_change %}">Change your password</a> </li>
+  </ul>
+{% endblock %}
diff --git a/sweettooth/auth/urls.py b/sweettooth/auth/urls.py
index 2d15e73..d35d73d 100644
--- a/sweettooth/auth/urls.py
+++ b/sweettooth/auth/urls.py
@@ -1,4 +1,5 @@
 
+from django.views.generic.simple import direct_to_template
 from django.conf.urls.defaults import patterns, url, include
 from auth import views, forms
 from registration.views import register
@@ -15,6 +16,10 @@ urlpatterns = patterns('',
         dict(form_class=forms.AutoFocusRegistrationForm),
         name='registration_register'),
 
+    url(r'settings/(?P<user>.+)', direct_to_template,
+        dict(template='registration/settings.html'),
+        name='auth-settings'),
+
     url(r'', include('registration.urls')),
     url(r'^profile/(?P<user>.+)', views.profile, name='auth-profile'),
     url(r'^profile/', views.profile_redirect, name='auth-profile'),
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index 90490e5..dce8753 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -36,7 +36,7 @@ window._SW = function() {
         <div class="user_settings">
           <ul>
             <li><a href="{% url auth-profile user=request.user.username %}">Your profile</a></li>
-            <!-- <li><a href="#">Settings</a></li> -->
+            <li><a href="{% url auth-settings user=request.user.username %}">Settings</a></li>
             <li><a href="{% url auth-logout %}">Log out</a></li>
           </ul>
         </div>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]