perfood / couch-auth

Powerful authentication for APIs and apps using CouchDB (or Cloudant) with Node >= 14
MIT License
66 stars 19 forks source link

Handle uncaught error sending email during registration and emit event. #84

Closed mugwhump closed 1 month ago

mugwhump commented 6 months ago

Fixes #71 During user creation, an exception while sending the confirmation email would hang express. Wrap the email confirmation sending in try/catch. Emit event 'confirmation-email-error' if mail fails to send.

I also noted that the promise returned by createUser() is a promise-constructor anti-pattern, exceptions thrown by prepareNewUser() and insertNewUserDocument() might also hang Express. Though I'm not sure what those exceptions might be.