static async fetchByEmail(req, res, next) {
    try {
      const user = await userService.getUserByEmail(req.body);

      if (user) {
        if (passwordHash.verify(req.body.password, user.get('password'))) {
          res.json({
            success: true,
            data: user
          });
        } else {
          res.json({
            success: false
          });
        }
      } else {
        res.json({
          success: false
        });
      }
    } catch (err) {
      res.status(500).json({ success: false, error: err.message });
    }
  }
/**
   * Get a user by its email.
   *
   * @param {Object} req
   * @param {Object} res
   * @param {Function} next
   */
Get a user by its email.
Get a user by its email .
static async fetchByEmail(req, res, next) {
    try {
      const user = await userService.getUserByEmail(req.body);
      if (user) {
        if (passwordHash.verify(req.body.password, user.get('password'))) {
          res.json({
            success: true,
            data: user
          });
        } else {
          res.json({
            success: false
          });
        }
      } else {
        res.json({
          success: false
        });
      }
    } catch (err) {
      res.status(500).json({ success: false, error: err.message });
    }
  }
static async fetchByEmail ( req , res , next ) { try { const user = await userService . getUserByEmail ( req . body ) ; if ( user ) { if ( passwordHash . verify ( req . body . password , user . get ( 'password' ) ) ) { res . json ( { success : true , data : user } ) ; } else { res . json ( { success : false } ) ; } } else { res . json ( { success : false } ) ; } } catch ( err ) { res . status ( 500 ) . json ( { success : false , error : err . message } ) ; } }
Get a user by its email.
Get a user by its email .