JKHeadley / appy-backend

A user system to bootstrap your app.
https://appyapp.io
MIT License
108 stars 30 forks source link

POST /login/forgot - "statusCode": 504, "error": "Gateway Timeout", "message": "An error occurred." #20

Closed jadgsam closed 6 years ago

jadgsam commented 6 years ago

Hi @JKHeadley, I was following the flow of registering a new user which I did it using POST /login but when trying to test the flow for forgot password /login/forgot I got the following:

[05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — 535 5.7.8 https://support.google.com/mail/?p=BadCredentials e16sm13427923qtk.32 - gsmtp [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at SMTPConnection._formatError (/Users/jadsam/Documents/VestraHub/appy/node_modules/smtp-connection/lib/smtp-connection.js:528:15) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at SMTPConnection._actionAUTHComplete (/Users/jadsam/Documents/VestraHub/appy/node_modules/smtp-connection/lib/smtp-connection.js:1231:30) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at SMTPConnection. (/Users/jadsam/Documents/VestraHub/appy/node_modules/smtp-connection/lib/smtp-connection.js:319:22) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at SMTPConnection._processResponse (/Users/jadsam/Documents/VestraHub/appy/node_modules/smtp-connection/lib/smtp-connection.js:669:16) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at SMTPConnection._onData (/Users/jadsam/Documents/VestraHub/appy/node_modules/smtp-connection/lib/smtp-connection.js:493:10) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at emitOne (events.js:116:13) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at TLSSocket.emit (events.js:211:7) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at addChunk (_stream_readable.js:263:12) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at readableAddChunk (_stream_readable.js:250:11) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at TLSSocket.Readable.push (_stream_readable.js:208:10) [05:54:13.539] 28930 ERROR server/api/login.js:338:15 api/Forgot Password — at TLSWrap.onread (net.js:594:20) Debug: handler, error {"msec":1230.931826978922,"error":"An error occurred.","data":{"isBoom":true,"isServer":true,"output":{"statusCode":504,"payload":{"statusCode":504,"error":"Gateway Timeout","message":"An error occurred."},"headers":{}}}}

JKHeadley commented 6 years ago

hi @jadgsam, You will need to set your own values for SMTP configuration in order for emails to work.

Basically, in config.js replace all instances of appyhapi@gmail.com with your own email that you will be using, and in you .env file set SMPT_PASSWORD equal to the password for that email.

jadgsam commented 6 years ago

Hi @JKHeadley, Thanks for your quick feedback.

Now it works, however, I have 2 questions:

  1. I am getting an email with the subject "Reset your appy Admin password", Admin is referring to the role to which the user I am resetting the password is related to? Currently, the user is associated with the role User

  2. Even though I replaced appyhapi@gmail.com by my own email I am getting the following message there instead of sending the message to the email address associated with the registered user. So, as a result, the end user is not going to get the token to reset the password.

Forgot your password? We received a request to reset the password for your account, you will need the token below.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRpYXpqb3NlYW50b25pb0Bob3RtYWlsLmNvbSIsImtleSI6ImVlMzc4OGJiLTNiOGEtNDlkOS05NmM1LTdkNzVhOTdkOWNjYiIsImlhdCI6MTUxNzQ3MTcxNSwiZXhwIjoxNTE3NDg2MTE1fQ.1Nm3vT6HW3xNg1kfBmaHha2TmYPdxLGR1OG3prB77KI

Love,

The appy Admin Team

JKHeadley commented 6 years ago

Hi @jadgsam 1) appy Admin is simply the value of the websiteName property in config.js, not the user's role.

2) If you want to send emails to the correct addresses, set the defaultEmail config property to null.

jadgsam commented 6 years ago

Hi @JKHeadley, thanks it works perfect