Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Remove resetToken and password from User global
Browse files Browse the repository at this point in the history
  • Loading branch information
claviska committed May 25, 2017
1 parent 876c264 commit ab497f7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/models/user_model.js
Expand Up @@ -141,6 +141,7 @@ module.exports = (sequelize, DataTypes) => {
// Fetch the user
user
.findOne({
attributes: { exclude: ['resetToken'] },
where: {
id: decoded.data.id
}
Expand All @@ -161,6 +162,9 @@ module.exports = (sequelize, DataTypes) => {
reject(new Error('Invalid auth token.'));
}

// Remove password
user.password = undefined;

return resolve(user);
})
.catch(() => reject(new Error('Error fetching user from the database.')));
Expand Down

0 comments on commit ab497f7

Please sign in to comment.