简体   繁体   English

尝试重置密码时出现身份验证错误 - django

[英]Authentication Error when trying to reset password - django

I try to reset password with gmail.com.我尝试使用 gmail.com 重置密码。 I think I set everything correct, but it's still doesn't work and raise error like so:我想我把一切都设置正确了,但它仍然不起作用并引发如下错误: 正如你在这里看到的

settings.py设置.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = os.environ.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PASS')

I set my enviroment variables EMAIL_USER (login to my gmail account) and EMAIL_PASS (16-sign password provided by Google when you use 2-step authentication - Google App Password).我设置了环境变量EMAIL_USER (登录到我的 gmail 帐户)和EMAIL_PASS (当您使用两步身份验证时由 Google 提供的 16 签名密码 - Google App 密码)。 I tried also use password to my gmail account but this also not work.我也尝试将密码用于我的 gmail 帐户,但这也不起作用。 Someone know what I do wrong ?有人知道我做错了什么吗? Thanks for any help.谢谢你的帮助。

Change the EMAIL_PORT to be 465将 EMAIL_PORT 更改为 465

EMAIL_PORT = 465

Using smtplib to connect directly to the gmail stmp server it fails with port 587 but works with 465:使用 smtplib 直接连接到 gmail stmp 服务器,它在端口 587 上失败,但在 465 上工作:

server=smtplib.SMTP_SSL('smtp.gmail.com', 465)
account="MY ACCOUNT LOG IN"
password="MY APP PASSWORD"
server.login(account, password) 

returns:返回:

(235, b'2.7.0 Accepted')

However然而

server=smtplib.SMTP_SSL('smtp.gmail.com', 587)
account="MY ACCOUNT LOG IN"
password="MY APP PASSWORD"
server.login(account, password)

Gives a time out error.给出超时错误。 And connecting without SSL isn't supported for gmail: gmail 不支持不使用 SSL 进行连接:

server=smtplib.SMTP('smtp.gmail.com', 587)
account="MY ACCOUNT LOG IN"
password="MY APP PASSWORD"
server.login(account, password)

Returns退货

smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 django身份验证和密码重置 - django authentication and password reset 尝试使用 firebase ZF20E3C5E54C0AB3D37AZ5D660B63 生成 django 中的密码重置 email 链接时出错 - Getting Error when trying to Generate password reset email link in django using firebase SDK Djongo + Django + MongoDB Atlas 数据库尝试重置密码时出错 - Djongo + Django + MongoDB Atlas DatabaseError when trying to reset password 尝试创建重置密码身份验证时出现Password_reset_done错误 - Password_reset_done error when attempting to create reset password authentication 尝试在服务器上运行 django 应用程序时密码验证失败 - Password authentication failed when trying to run django application on server 尝试在圆形立方体中使用密码重置插件时出现 PHP 错误 - PHP error when trying to use password reset plugin in roundcube django密码重置NoReverseMatch错误 - django password reset NoReverseMatch error Django:Django注册密码重置错误 - Django: Django-Registration Password Reset Error 运行Django的sqlall命令时出现密码验证失败错误 - Password Authentication Failure error when running Django's sqlall command 在 Django 中使用内置的重置密码和密码更改时如何显示错误消息 - how can i display error messages when using the inbuilt reset password and password change in Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM