Changing password in Django

Add this to your

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:

{% 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 %}
        <input type="submit" value="Change" class="btn btn-primary btn-lg" />
        {% csrf_token %}
{% endblock %}

{% 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="">re-login</a> with your new credentials
        or go back to the <a href="">main page</a>.
{% endblock %}

That's it! It should work fine. Here's what it looks like using Bootstrap.

Popular posts from this blog

Set table width to 100% on PDF export in Datatables

Hot/Cute flat-chested Girls