Reputation: 61
I am currently trying to create a password reset form for my site.I have looked on several questions similar to this one but none provide the answer for me. I have also created an app password on the gmail website and I am using that as I have 2FA. I am getting the error:
SMTPSenderRefused at /password-reset/
(530, b'5.7.0 Authentication Required. Learn more at\n5.7.0 https://support.google.com/mail/?p=WantAuthError n8sm12016723wrm.46 - gsmtp', 'webmaster@localhost')
My settings.py code:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAL_HOST_USER = '***********'
EMAIL_HOST_PASSWORD = '*********'
urls.py file, where the view has been instantiated:
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path, include
from users import views as user_views
urlpatterns = [
path('password-reset/', auth_views.PasswordResetView.as_view(template_name='users/password_reset.html'), name='password_reset'),
path('password-reset/done', auth_views.PasswordResetDoneView.as_view(template_name='users/password_reset_done.html'), name='password_reset_done'),
path('password-reset-confirm/<uidb64>/<token>', auth_views.PasswordResetConfirmView.as_view(template_name='users/password_reset_confirm.html'), name='password_reset_confirm'),
]
Upvotes: 1
Views: 710
Reputation: 1221
Using the
gmail app password
through you can send the email not provide the actual password and no one can login in your account. Without enable less secure apps setting here is give the link try and it's work let me know if it right google or gmail app password
after it change the actual password to your app password in
setting.py
file EMAIL_HOST_PASSWORD = 'your app password'
give by google
not change in other constant
if you do not use 2 step email verification you need to use third party service here i give the link you see sendgrid
Follow I give link Password reset django If it work make right answer so let me know right or not
Upvotes: 1
Reputation: 315
You have to allow third part access in your mail account for this
Upvotes: 0