diff options
| author | Rubén Beltrán del Río <ben@nsovocal.com> | 2017-02-19 01:59:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-19 01:59:26 -0600 |
| commit | e5fdb2d460feed6beda8cac764b15f173b67159d (patch) | |
| tree | 8dd6321a5966b29c69d9750495dc9b72bfdceb8b /lib | |
| parent | 7404eac982a0d928866aeddaa1a0ea4d1f2d3870 (diff) | |
Check the Account SID (#3)
* Add twilio config to readme
* Modify wording of main menu.
* Modify wording of recording message
* Add account sid setting to readme
* Add the twilio account sid to config
* Add check for accountSid
* Update paw to send AccountSid
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/controllers/main_menu.js | 6 | ||||
| -rw-r--r-- | lib/controllers/recordings.js | 5 | ||||
| -rw-r--r-- | lib/dead_drop.js | 14 |
3 files changed, 19 insertions, 6 deletions
diff --git a/lib/controllers/main_menu.js b/lib/controllers/main_menu.js index 461cff8..06e172b 100644 --- a/lib/controllers/main_menu.js +++ b/lib/controllers/main_menu.js @@ -13,9 +13,9 @@ internals.kMainMenuRoute = '/menus/main'; internals.kRecordingMenuRoute = '/menus/recording'; internals.kRandomMessageRoute = '/recordings/0'; internals.kLeaveMessageRoute = '/recordings'; -internals.kMenuMessage = 'Para dejar un mensaje, presiona 1. ' + - 'Para escuchar un mensaje al azar, presiona 2. ' + - 'Para escuchar un mensaje específico, presioan 3.'; // the message that will be shown +internals.kMenuMessage = 'Marca 1 para grabar mensaje. ' + + 'Marca 2 para escuchar mensaje al azar. ' + + 'Marca 3 si conoces el número de mensaje'; // the message that will be shown internals.kMenuInvalidResponseMessage = 'No entendí... Volviendo al menu principal.'; // invalid selection message internals.kMenuOptions = { leaveMessage: 1, diff --git a/lib/controllers/recordings.js b/lib/controllers/recordings.js index 591dbd5..c7a7584 100644 --- a/lib/controllers/recordings.js +++ b/lib/controllers/recordings.js @@ -10,10 +10,9 @@ const internals = {}; internals.kContentType = 'application/xml'; // The content type used to respond internals.kLanguage = 'es-mx'; // the language to use internals.kMaxMessageLength = 30; // max message length in seconds -internals.kIdDateFormat = 'YYMMDDHHmmssSSS'; // derive ids from current date. 15 digits. internals.kRecordingsSet = 'recordings'; -internals.kRecordMessage = 'Graba tu mensaje despues del bip. ' + - 'Presiona cualquier tecla para finalizar tu mensaje. '; // the recording message +internals.kRecordMessage = 'Graba tu mensaje despues del bip y ' + + 'presiona cualquier tecla para finalizar. '; // the recording message internals.kConfirmationMessage = 'Gracias. Tu mensaje es el número: '; internals.kNotFoundMessage = 'Mensaje no encontrado. Adiós!'; diff --git a/lib/dead_drop.js b/lib/dead_drop.js index 6f97645..3336444 100644 --- a/lib/dead_drop.js +++ b/lib/dead_drop.js @@ -45,10 +45,24 @@ module.exports = internals.DeadDrop = class DeadDrop { _initializeServer() { + const self = this; + this._app = Koa(); this._app.use(KoaBodyParser()); + this._app.use(function * (next) { + + const accountSid = this.request.body.AccountSid || this.request.query.AccountSid; + + if (accountSid === self.twilioAccountSid) { + yield next; + } + else { + this.throw('Unauthorized', 401); + } + }); + this._initializeMainMenuRoutes(); this._initializeRecordingMenuRoutes(); this._initializeRecordingsRoutes(); |