I'm making a website and one of the features is that when user forgets his password he can reset it. We all know that templates provided by django aren't beautiful so I created my own. and everything works but the password_reset_confirm Just to be clear if i have my custom templates on every view (reset_password, password_reset_done and password_reset_complete) but I'm using django provided password_reset_confirm page works password is changed but when im using my template and form for this password stays the same Thanks for your help and have a great day btw if some code in views is requied im working with function based views
Forms.py
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
class CustomPasswordResetForm(PasswordResetForm):
email = forms.EmailField(widget=forms.TextInput(attrs={'class':'registerForm','name':'email'}))
class NewPasswordResetForm(SetPasswordForm):
error_messages = {
'password_mismatch': ('New Passwords and Confirm Passwords not matching'),
}
password1 = forms.CharField(widget=forms.PasswordInput(attrs={'class':'registerForm','name':'new_password1','id':'id_new_password1'}))
password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class':'registerForm','name':'new_password2','id':'id_new_password2'})
Urls.py
from .forms import CustomPasswordResetForm, NewPasswordResetForm
path('reset_password/', reset.PasswordResetView.as_view(template_name="resetPassword.html",form_class=CustomPasswordResetForm), name="reset_password"),
path('new_password_send/', reset.PasswordResetDoneView.as_view(template_name="resetPasswordDone.html",), name="password_reset_done"),
path('reset/<uidb64>/<token>/', reset.PasswordResetConfirmView.as_view(template_name="resetPasswordNew.html", form_class=NewPasswordResetForm), name="password_reset_confirm"),
path('reset_password_complete/', reset.PasswordResetCompleteView.as_view(template_name="resetPasswordComplete.html"), name="password_reset_complete"),
HTML
<form method="POST" action="">
{% csrf_token %}
<div class="form-group">
{{ form.password1 }}
</div>
<div class="form-group">
{{ form.password2 }}
</div>
<button type="submit" class="btnSbtRegister">
<span class="textSbtRegister">
{% trans "Change Pass" %}
</span>
</button>
</form>