refs #6434 feat: insert record just when fail
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
6af99b7669
commit
5a36fabf05
|
@ -135,6 +135,7 @@ module.exports = function(Self) {
|
||||||
Self.signInValidate = async(user, userToken, token, ctx) => {
|
Self.signInValidate = async(user, userToken, token, ctx) => {
|
||||||
const [[key, value]] = Object.entries(Self.userUses(user));
|
const [[key, value]] = Object.entries(Self.userUses(user));
|
||||||
const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]);
|
const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]);
|
||||||
|
if (!isOwner) {
|
||||||
await Self.app.models.SignInLog.create({
|
await Self.app.models.SignInLog.create({
|
||||||
userName: user,
|
userName: user,
|
||||||
token: token.id,
|
token: token.id,
|
||||||
|
@ -142,7 +143,7 @@ module.exports = function(Self) {
|
||||||
ip: ctx.req.ip,
|
ip: ctx.req.ip,
|
||||||
owner: isOwner
|
owner: isOwner
|
||||||
});
|
});
|
||||||
if (!isOwner)
|
}
|
||||||
throw new UserError('Try again');
|
throw new UserError('Try again');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue