I followed the code here: http://drumcoder.co.uk/blog/2010/apr/09/django-reset-password/ as well as here: http://shrenikp.webs.com/apps/blog/entries/show/7133721-implement-forgot-password-on-customer-ui- and here: http://blog.montylounge.com/2009/07/12/django-forgot-password/
This is the code I currently wish to work with and what I have it at currently
[base.html]
<form name="login_form" action="/login/" method="post" accept-charset="utf-8" style="display: inline">
{% csrf_token %}
Username: <input type="text" name="username" value="" /><br />
Password: <input type="password" name="password" value="" /><br />
<input type="submit" value="submit" value = "" id ="submit" />
开发者_开发问答 <p><a href="{% url password_reset %}">Forgot password?</a></p>
</form>
[url.py]
urlpatterns = patterns('',
url(r'^password_reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'),
(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
(r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
)
I get an error something like this:
unknown specifier: ?P[
this line error for some reason... (r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$' any help?
You're going to need to change it to this:
(r'^reset/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$', 'django.contrib.auth.views.password_reset_confirm')
You need to add the tag {% csrf_token %}
after your <form>
mark-up in your template. Try that.
精彩评论