You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
497 B
JavaScript
25 lines
497 B
JavaScript
module.exports = {
|
|
inputs: {
|
|
emailOrUsername: {
|
|
type: 'string',
|
|
required: true,
|
|
},
|
|
includeSSOUsers: {
|
|
type: 'boolean',
|
|
defaultsTo: true,
|
|
},
|
|
},
|
|
|
|
async fn(inputs) {
|
|
const fieldName = inputs.emailOrUsername.includes('@') ? 'email' : 'username';
|
|
|
|
const conditions = { [fieldName]: inputs.emailOrUsername.toLowerCase() };
|
|
|
|
if (includeSSOUsers) {
|
|
conditions[ssoId] = null;
|
|
}
|
|
|
|
return sails.helpers.users.getOne(conditions);
|
|
},
|
|
};
|