#6434 - signIn_issue #1892

Merged
jsegarra merged 20 commits from 6434-signIn_issue into dev 2023-12-22 09:36:33 +00:00
1 changed files with 10 additions and 9 deletions
Showing only changes of commit 5a36fabf05 - Show all commits
back/models

View File

@ -135,15 +135,16 @@ module.exports = function(Self) {
Self.signInValidate = async(user, userToken, token, ctx) => {
const [[key, value]] = Object.entries(Self.userUses(user));
const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]);
await Self.app.models.SignInLog.create({
userName: user,
token: token.id,
userFk: userToken.id,
ip: ctx.req.ip,
owner: isOwner
});
if (!isOwner)
throw new UserError('Try again');
if (!isOwner) {
await Self.app.models.SignInLog.create({
userName: user,
token: token.id,
userFk: userToken.id,
ip: ctx.req.ip,
owner: isOwner
});
}
throw new UserError('Try again');
jsegarra marked this conversation as resolved Outdated
Outdated
Review

El throw también debería ir dentro del if.

El `throw` también debería ir dentro del `if`.
};
/**