diff --git a/back/models/vn-user.js b/back/models/vn-user.js index c7fe3012f..e000aa4c7 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -126,12 +126,7 @@ module.exports = function (Self) { }); Self.signInValidate = async (user, userToken, token, ctx) => { const [[key, value]] = Object.entries(Self.userUses(user)); - const where = Self.userUses(user); - const vnUser = await Self.findOne({ - fields: ['id', 'username', 'email'], - where - }); - const isOwner = userToken[key].toLowerCase() === vnUser[key].toLowerCase(); + const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]); await Self.app.models.SignInLog.create({ token: token.id, userFk: userToken.id,