i know compare password using bcrypt module is work too, but out of curiousity, i want to know if there is a away to using sequelize fn and postgres crypt?
i already try this :
const user = await Users.findOne({
where: {
username: myUsername,
password: sequelize.fn('crypt',myPassword,'password')
}
});
but not work because in the queries look like
SELECT "id", "username", "password", FROM "users" AS "Users"
WHERE "Users"."username" = 'yosiazwan' AND "Users"."password" = crypt('testing', 'password');
'password' is in single quotes when it should not. if i try that queries in pgadmin, it doesn't work too. but if i remove the 'password' single quotes, like this
SELECT "id", "username", "password", FROM "users" AS "Users"
WHERE "Users"."username" = 'yosiazwan' AND "Users"."password" = crypt('testing', password);
and that will works. is there any way to remove that single quotes in sequelize fn?