Skip to content

Commit

Permalink
Fixing institution id
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasgehl3n committed Nov 14, 2023
1 parent ef42a19 commit 481fcd6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"pg": "^8.11.2",
"redis": "^4.6.10",
"sequelize": "^6.32.1",
"sequelize-cli": "^6.6.1",
"ts-node": "^10.9.1",
Expand Down
1 change: 1 addition & 0 deletions src/controllers/InstitutionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const _mapRequestToData = async (req: Request) => {
);

if (!data.id) {
data.id = null;
const authenticatedRequest = req as unknown as AuthenticatedRequest;
data.idUserCreator = authenticatedRequest.user!.id;
}
Expand Down
22 changes: 11 additions & 11 deletions src/middlewares/authentication/PassportManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ export default class PassportManager {
passport.use(new LocalStrategy({
usernameField: 'email',
passwordField: 'password'
}, async (email, password, done) => {
}, async (email, password, done) => {
const user = await UserService.GetByEmail(email);
if(user){
// bcrypt.compare(password, user.encriptedPassword, (err, res) => {
// if (res || err) {
this.SerializeUser();
this.DeserializeUser();
done(null, user);
// } else {
// return done(null, false, { message: 'Credenciais inválidas!' });
// }
// });
if (user) {
bcrypt.compare(password, user.encriptedPassword, (err, res) => {
// if (res || err) {
this.SerializeUser();
this.DeserializeUser();
done(null, user);
// } else {
// return done(null, false, { message: 'Credenciais inválidas!' });
// }
});
}
}));
}
Expand Down

0 comments on commit 481fcd6

Please sign in to comment.