I'm using default django for reset my user password. Strange thing is i can send email in my code, i receive them. BUT only for the reset password from django i never receive email ...
My django version is Django==3.1.2
Django settings:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER ='****@gmail.com'
EMAIL_HOST_PASSWORD = '*****'
My django URL :
path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),
path('password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
The HTML :
<form >
{% csrf_token %}
{{ form.as_p }}
<div >
<button type="submit" >Reset</button>
</div>
</form>
When i click on reset button the URL of the page changed to : http://localhost:8000/password_reset/?csrfmiddlewaretoken=MY_TOKEN&email=*******@hotmail.com
I can send email using django shell, it's working. I also tried to check if user has is_active True and if user has usable password:
[(u.email, u.is_active, u.has_usable_password()) for u in get_user_model().objects.all()]
I got :
[('******', True, True), ('****', True, True), ('****', True, True), ('*****', True, True)]
CodePudding user response:
You need to make a POST request, so:
<form method="post"> … </form>