diff --git a/back/methods/vn-user/recover-passwordSMS.js b/back/methods/vn-user/recover-passwordSMS.js index 9f8118a29..bd14324d3 100644 --- a/back/methods/vn-user/recover-passwordSMS.js +++ b/back/methods/vn-user/recover-passwordSMS.js @@ -1,3 +1,4 @@ +const isProduction = require('vn-loopback/server/boot/isProduction'); const UserError = require('vn-loopback/util/user-error'); const authCode = require('../../models/authCode'); module.exports = Self => { @@ -50,9 +51,9 @@ module.exports = Self => { const code = await authCode(user, myOptions); - if (process.env.NODE_ENV === 'production') - await Self.app.models.Sms.send({req: {accessToken: {userId: id}}}, +userId, code); - return {code}; + if (!isProduction()) + return {code}; + await Self.app.models.Sms.send({req: {accessToken: {userId: id}}}, +userId, code); } catch (err) { if (err.code === 'EMAIL_NOT_FOUND') return;