Merge branch '6434-improve-signInLog' of https://gitea.verdnatura.es/verdnatura/salix into 6434-improve-signInLog

This commit is contained in:
Javier Segarra 2023-11-28 12:39:29 +01:00
commit f4f02c98c0
3 changed files with 30 additions and 1 deletions

View File

@ -12,6 +12,7 @@
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"cSpell.words": [
"loopback",
"salix",
"fdescribe"
]

View File

@ -124,6 +124,14 @@ module.exports = function(Self) {
return email.send();
});
/**
* Sign-in validate. *
* @param {Integer} user The user
* @param {Object} userToken Options
* @param {Object} token accessToken
* @param {Object} ctx context
*/
Self.signInValidate = async(user, userToken, token, ctx) => {
const [[key, value]] = Object.entries(Self.userUses(user));
const isOwner = Self.rawSql(`SELECT ? = ? `, [userToken[key], value]);
@ -139,7 +147,13 @@ module.exports = function(Self) {
}
};
Self.validateLogin = async function(user, password, ctx = null) {
/**
* Validate login params*
* @param {String} user The user
* @param {String} password
* @param {Object} ctx context
*/
Self.validateLogin = async function(user, password, ctx) {
const loginInfo = Object.assign({password}, Self.userUses(user));
const token = await Self.login(loginInfo, 'user');

View File

@ -75,6 +75,20 @@ export default class Controller extends Section {
});
}
compareDate(date) {
let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
let comparation = today - timeTicket;
if (comparation == 0)
return 'warning';
if (comparation < 0)
return 'success';
}
get checked() {
const tickets = this.$.model.data || [];
const checkedLines = [];