#6434 - SignIn issue_improve-signInLogMethod #1848

Closed
jsegarra wants to merge 65 commits from 6434-improve-signInLog into test
2 changed files with 20 additions and 1 deletions
Showing only changes of commit 750f8665f4 - Show all commits

View File

@ -10,5 +10,10 @@
"eslint.format.enable": true,
"[javascript]": {
"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,6 +147,12 @@ module.exports = function(Self) {
}
};
/**
* 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');