Archived
Password change and reset function with templates.
Try reusing https://docs.djangoproject.com/en/dev/topics/auth/#module-django.contrib.auth.views to greatest extent.
This commit is contained in:
1 parent
1acc0063a8
commit
0efcf25f05
11 files changed
+77
-3
No files matched your search
+6
-1
@@ -1,3 +1,8 @@
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
from django.contrib.auth.forms import PasswordChangeForm, SetPasswordForm
|
||||
class LDAPPasswordChangeForm(PasswordChangeForm):
|
||||
# TODO: Change password here
|
||||
pass
|
||||
|
||||
class LDAPSetPasswordForm(SetPasswordForm):
|
||||
# TODO: Set password here
|
||||
pass
|
||||
@@ -1 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<a href="{% url main.views.profile %}">{{request.user}}s profile</a>
|
||||
<a href="{% url django.contrib.auth.views.password_reset %}">Forgot password?</a>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Change password done{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
The page shown after a user has changed their password.
|
||||
</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Change password{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
Allows a user to change their password.
|
||||
</p>
|
||||
<form method="post">
|
||||
{{form}}
|
||||
<input type="submit" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Password reset complete{% endblock %}
|
||||
{% block content %}
|
||||
The page shown after a user has been emailed a link to reset their password.
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Password reset confirmation{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
Presents a form for entering a new password.
|
||||
</p>
|
||||
{% if validlink %}
|
||||
<form method="post">
|
||||
{{form}}
|
||||
<input type="submit" />
|
||||
{% else %}
|
||||
The password reset link is not valid or allready used.
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Password reset done{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
The page shown after a user has been emailed a link to reset their password.
|
||||
</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,2 @@
|
||||
Someone asked for password reset for email {{ email }}. Follow the link below:
|
||||
{{ protocol }}://{{ site_name }}{% url 'auth_password_reset_confirm' uidb36=uid token=token %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Reset password{% endblock %}
|
||||
{% block content %}
|
||||
<p>
|
||||
Allows a user to reset their password by generating a one-time use link that can be used to reset the password, and sending that link to the user's registered email address.
|
||||
<form method="post">
|
||||
{{ form }}
|
||||
<input type="submit" />
|
||||
</form>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[neuf-userinfo] Reset password
|
||||
@@ -1,17 +1,22 @@
|
||||
from django.conf.urls.defaults import *
|
||||
from django.contrib import admin
|
||||
from main.forms import LDAPPasswordChangeForm
|
||||
from main.forms import LDAPPasswordChangeForm, LDAPSetPasswordForm
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
(r'^accounts/$', 'main.views.profile'),
|
||||
(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
|
||||
(r'^accounts/password/change$', 'django.contrib.auth.views.password_change',
|
||||
{'password_change_form': LDAPPasswordChangeForm}),
|
||||
(r'^accounts/password/change/done$', 'django.contrib.auth.views.password_change_done'),
|
||||
(r'^accounts/password/reset$', 'django.contrib.auth.views.password_reset'),
|
||||
(r'^accounts/password/reset/done$', 'django.contrib.auth.views.password_reset_done'),
|
||||
(r'^accounts/password/reset/confirm$', 'django.contrib.auth.views.password_reset_confirm',
|
||||
{'set_password_form': LDAPSetPasswordForm}),
|
||||
(r'^accounts/password/reset/complete$', 'django.contrib.auth.views.password_reset_complete'),
|
||||
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
|
||||
(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
|
||||
(r'^accounts/(?P<username>)/', 'main.views.profile'),
|
||||
(r'^$', 'main.views.index'),
|
||||
)
|
||||
Reference in new issue
Block a user