Changing password in Django
Add this to your urls.py:
Just edit the links above. Then in you templates folder, create new folder and name it registration . . Then create this html file below:
password_change_form.html
password_change_done.html
That's it! It should work fine. Here's what it looks like using Bootstrap.
url(r'^accounts/change-password/', 'django.contrib.auth.views.password_change', {'post_change_redirect' : '/accounts/password-changed/'}), url(r'^accounts/password-changed/', 'django.contrib.auth.views.password_change_done'),
Just edit the links above. Then in you templates folder, create new folder and name it registration . . Then create this html file below:
password_change_form.html
{% extends "edit_profile.html" %} {% block head_title %}Change Password{% endblock %} {% block content %} <div class="jumbotron" style="width: 940px; margin: 80px auto; border-radius: 5px;"> <form method="post" action="."> {% if next %} <input type="hidden" name="next" value="{{ next }}" /> {% endif %} {{form.as_p}} <input type="submit" value="Change" class="btn btn-primary btn-lg" /> {% csrf_token %} </form> </div> {% endblock %}
password_change_done.html
{% extends "edit_profile.html" %} {% block head_title %}Password Change Successful{% endblock %} {% block content %} <div class="jumbotron" style="border-radius: 5px; margin: 80px auto; width: 940px;"> <div class="alert alert-success" style="padding: 5px;"> Your password has been changed successfully. Please <a href="https://www.blogger.com/accounts/logout/">re-login</a> with your new credentials or go back to the <a href="https://www.blogger.com/accounts/loggedin/">main page</a>. </div> </div> {% endblock %}
That's it! It should work fine. Here's what it looks like using Bootstrap.
Comments
Post a Comment
Feel free to ask, suggest and comment regarding this post/blog. You can also contact me through e-mail, just always use the contact page. Thank you for visiting this blog.