Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
controller.phoneCode = async (req) => {
if (!module.config.sms) throw '!module.config.sms';
const smsConfig = module.config.sms;
const { phone } = req.data;
const code = random(100000, 999999);
controller.lastCode = code;
const smsText = `Ваш проверочный код: ${code}`;
if (module.tbot) {
module.tbot.notify(`Номер: ${phone}\n${smsText}`);
}
const text = transliterate(smsText);
let res;
// console.log('smsConfig.provider', smsConfig.provider);
if (smsConfig.provider === 'bytehand') {
const qs = {
...smsConfig.params,
to: phone,
text,
};
res = await ctx.api.fetch('http://bytehand.com:3800/send', { qs });
} else if (smsConfig.provider === 'nexmo') {
const body = {
...smsConfig.params,
to: phone,
text,
};
async phoneCode(req) {
if (!this.app.modules.auth.config.sms) throw '!module.config.sms';
const smsConfig = this.app.modules.auth.config.sms;
const { phone } = req.data;
const code = random(100000, 999999);
this.lastCode = code;
const smsText = `Ваш проверочный код: ${code}`;
if (this.app.modules.auth.tbot) {
this.app.modules.auth.tbot.notify(`Номер: ${phone}\n${smsText}`);
}
const text = transliterate(smsText);
let res;
// console.log('smsConfig.provider', smsConfig.provider);
if (smsConfig.provider === 'bytehand') {
const qs = {
...smsConfig.params,
to: phone,
text,
};
res = await this.app.api.fetch('http://bytehand.com:3800/send', { qs });
} else if (smsConfig.provider === 'nexmo') {
const body = {
...smsConfig.params,
to: phone,
text,
};