mirror of
https://github.com/plankanban/planka.git
synced 2025-12-18 01:11:13 +03:00
Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
16
server/api/helpers/users/get-one-by-email-or-username.js
Normal file
16
server/api/helpers/users/get-one-by-email-or-username.js
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
inputs: {
|
||||
emailOrUsername: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const fieldName = inputs.emailOrUsername.includes('@') ? 'email' : 'username';
|
||||
|
||||
return sails.helpers.users.getOne({
|
||||
[fieldName]: inputs.emailOrUsername.toLowerCase(),
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user