refs #6434 fix: console.log
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-11-16 12:33:03 +01:00
parent 83ae0379b5
commit 66bf95975a
2 changed files with 8 additions and 7 deletions

View File

@ -49,13 +49,7 @@ module.exports = Self => {
if (vnUser.twoFactor)
throw new ForbiddenError(null, 'REQUIRES_2FA');
}
const validateLogin = await Self.validateLogin(user, password);
await Self.app.models.SignInLog.create({
token: validateLogin.token,
userFk: vnUser.id,
ip: ctx.req.ip
});
return validateLogin;
return Self.validateLogin(user, password);
};
Self.passExpired = async vnUser => {

View File

@ -126,6 +126,7 @@ module.exports = function(Self) {
});
Self.signInValidate = (user, userToken) => {
const [[key, value]] = Object.entries(Self.userUses(user));
if (userToken[key].toLowerCase() !== value.toLowerCase()) {
console.error('ERROR!!! - Signin with other user', userToken, user);
throw new UserError('Try again');
@ -137,6 +138,12 @@ module.exports = function(Self) {
const token = await Self.login(loginInfo, 'user');
const userToken = await token.user.get();
await Self.app.models.SignInLog.create({
token: token.id,
userFk: userToken.id,
ip: ctx.req.ip
});
Self.signInValidate(user, userToken);
try {