diff --git a/back/methods/sms/send.js b/back/methods/sms/send.js index 2d2a87311..b4293151d 100644 --- a/back/methods/sms/send.js +++ b/back/methods/sms/send.js @@ -38,7 +38,7 @@ module.exports = Self => { const [result] = response.result; const error = result.error_id; - if (senderFk) senderFk = ctx.req.accessToken.userId; + if (senderFk) senderFk = senderFk.req.accessToken.userId; const newSms = { senderFk, destination: destination, diff --git a/front/salix/components/recover-password/index.js b/front/salix/components/recover-password/index.js index ea52192bc..8bae19c92 100644 --- a/front/salix/components/recover-password/index.js +++ b/front/salix/components/recover-password/index.js @@ -44,7 +44,7 @@ export default class Controller { cb: data => { if (this.method && this.code) { data.token && this.goToChangePassword(data); - !data.token && this.goToLogin(); + if (!data.token) throw new UserError(`Credentials not valid`); } else this.handleCode(data.code); } diff --git a/modules/client/back/methods/client/sendSms.js b/modules/client/back/methods/client/sendSms.js index 270d7e5b5..f9e164fe4 100644 --- a/modules/client/back/methods/client/sendSms.js +++ b/modules/client/back/methods/client/sendSms.js @@ -32,7 +32,7 @@ module.exports = Self => { Self.sendSms = async(ctx, id, destination, message) => { const models = Self.app.models; - const sms = await models.Sms.send(ctx, destination, message); + const sms = await models.Sms.send(ctx, destination, message, {insert: true}); await models.ClientSms.create({ clientFk: id, diff --git a/modules/route/back/methods/route/sendSms.js b/modules/route/back/methods/route/sendSms.js index d1c3efa35..9326bc8c7 100644 --- a/modules/route/back/methods/route/sendSms.js +++ b/modules/route/back/methods/route/sendSms.js @@ -30,7 +30,7 @@ module.exports = Self => { const allSms = []; for (let client of targetClients) { - let sms = await Self.app.models.Sms.send(ctx, client, message); + let sms = await Self.app.models.Sms.send(ctx, client, message, {insert: true}); allSms.push(sms); } diff --git a/modules/ticket/back/methods/ticket/sendSms.js b/modules/ticket/back/methods/ticket/sendSms.js index 36e52fe3d..de8b7c282 100644 --- a/modules/ticket/back/methods/ticket/sendSms.js +++ b/modules/ticket/back/methods/ticket/sendSms.js @@ -32,7 +32,7 @@ module.exports = Self => { Self.sendSms = async(ctx, id, destination, message) => { const models = Self.app.models; - const sms = await models.Sms.send(ctx, destination, message); + const sms = await models.Sms.send(ctx, destination, message, {insert: true}); const {clientFk} = await models.Ticket.findById(id); await models.ClientSms.create({ clientFk,