Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getUserFields(req) {
const params = req.allParams();
// console.log({ params });
if (params.login) {
if (!params.username) {
params.username = params.login;
}
if (!params.email && validateEmail(params.login)) {
params.email = params.login;
} // if email
}
if (params.username) params.username = canonizeUsername(params.username);
if (params.email) params.email = canonize(params.email);
// console.log({ params });
return params;
}
controller.getUserFields = function (req) {
const params = req.allParams();
// console.log({ params });
if (params.login) {
if (!params.username) {
params.username = params.login;
}
if (!params.email && validateEmail(params.login)) {
params.email = params.login;
} // if email
}
if (params.username) params.username = canonizeUsername(params.username);
if (params.email) params.email = canonize(params.email);
// console.log({ params });
return params;
};
controller.getUserCriteria = function (req) {
schema.methods.generateUsername = async function a(collection) {
// const { User: UserModel } = ctx.models;
let username = `${this.providerId}_${this.provider}`;
username = canonizeUsername(username.toLowerCase());
if (!collection) return username;
if (!(await collection.count({ username }))) return username;
const prefixusername = `${username}_`;
// TODO!!!!!! убрать хуев китайский стайл цикл
username = prefixusername + (Math.random() % 100);
if (!(await collection.count({ username }))) return username;
username = prefixusername + (Math.random() % 100);
if (!(await collection.count({ username }))) return username;
throw 'cant generate unique username';
};
schema.methods.getUser = async function a() {