Skip to content

Commit

Permalink
Ft 164489780 Refactor user controller
Browse files Browse the repository at this point in the history
  • Loading branch information
jnkindi committed Apr 17, 2019
1 parent a433580 commit fcb0421
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ class User {
*/
static async loginWithEmail(req, res) {
const { email, password } = req.body;
const { email: username } = req.body;
try {
const user = await UserModel.findOne({
where: {
[Op.or]: [{ email }, { username: email }]
}
});
const user = await UserModel.findOne({ where: { [Op.or]: [{ email }, { username }] } });
// verify password
if (user && helper.comparePassword(password, user.password)) {
// return user and token
Expand Down

0 comments on commit fcb0421

Please sign in to comment.