Home > OS >  Unable to reset password in Django
Unable to reset password in Django

Time:01-29

I have an app which allows the user to reset password. I user the django authentification system but everytime I want to send an email I get the error ' 535, b'5.7.8 Username and Password not accepted. '.

I have already generated and app password and replace the password in my "settings.py" but I still get this error.

CodePudding user response:

This error message typically indicates that the username and password being used to authenticate with the email server are not accepted.

Here are a few things you can check to troubleshoot this issue:

Double-check that you have entered the correct username and app password in your "settings.py" file.

Make sure that the app password you generated is specifically for the email account you are using to send the password reset emails.

If you are using a Gmail account to send the emails, ensure that you have enabled "less secure apps" setting in your google account security settings.

Check that the email server you are trying to connect to is up and running.

Some email providers like Gmail, Yahoo, etc. may block the IP address from where the email is sent. Make sure that you are not being blocked.

You may also want to check the settings of your email server to ensure that it allows login from the IP address of your server.

Try to use a library like 'smtplib' instead of django's built-in email functionality to send the email, and see if that helps.

Finally, check the logs of the email server to see if there are any additional error messages that might provide more information about the issue.

CodePudding user response:

have you

  • tried sending passwords with a separate python script or application like the REST Client in VSC to assure the credentials are working? At least when using gmail I know you have to adapt the security settings in the gmail account used.
  • checked e.g. by using print statements (ONYL in you dev environment!) that the credentials are available as expected?
  • Related