Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default (email, password, done) =>
- User.findOne({
- where: { email },
- include: [{
- model: Roles,
- as: 'Roles'
- }, {
- model: Privileges,
- as: 'Privileges',
- }]
- }).then((user) => {
- if (!user) return done(null, false, { message: `There is no record of the email ${email}.` });
- return user.comparePassword(password, user.password).then(
- (result) => {
- if (result) done(null, user);
- else done(null, false, { message: 'Your email/password combination is incorrect.' });
- });
- }).catch((err) => {
- console.log(err);
- done(null, false, { message: 'Something went wrong trying to authenticate' });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement