wsfuller / elder-scrolls-legends-service

User Auth and Favorites service for Elder Scrolls Legends App
0 stars 0 forks source link

Validate user e-mails #2

Open wsfuller opened 4 years ago

wsfuller commented 4 years ago

Upon setting up the frontend, e-mail validation has not been implemented on the backend. Will need to validate all e-mails coming in beyond the basics of what the frontend will be responsible for

https://www.npmjs.com/package/email-validator

wsfuller commented 4 years ago

There is another small bug here where, if user email does not exist we are sending back a 500 error. The reason being is that on: https://github.com/wsfuller/elder-scrolls-legends-service/blob/master/routes/users.js#L49

email is undefined. Reason being is that originally req.body was deconstructed. This brought up, imo, some confusion between DB properties and request properties. So upon removing this deconstruction it created this bug.

Fix: return res.status(404).send(`No user with ${req.body.email} exists`);