From 7fd28d55a171d22c03792d99e5621a9050dc67ee Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 27 Jun 2018 20:26:45 +0000 Subject: [PATCH] be more specific with your feedback, please (and fix missing email addr) --- lib/extensions/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/extensions/index.js b/lib/extensions/index.js index 41a45dc..47d7085 100644 --- a/lib/extensions/index.js +++ b/lib/extensions/index.js @@ -156,12 +156,14 @@ module.exports.pairRequest = function (opts) { , aud: state.config.webminDomain , iat: Math.round(now / 1000) , id: authReq.id + , sub: authReq.subject , pin: pin , hostname: authReq.hostname }; auth = { id: authReq.id , secret: authReq.secret + , subject: authReq.subject , pin: pin , dt: now , exp: now + (2 * 60 * 60 * 1000) @@ -179,10 +181,14 @@ module.exports.pairPin = function (opts) { return state.Promise.resolve().then(function () { var pin = opts.pin; var secret = opts.secret; - var auth = Auths.getBySecretAndPin(secret, pin); + var auth = Auths.getBySecret(secret); if (!auth) { - throw new Error("I can't even right now - bad magic link or pairing code"); + throw new Error("Invalid magic link token '" + secret + "'"); + } + auth = Auths.getBySecretAndPin(secret, pin); + if (!auth) { + throw new Error("Invalid pairing code '" + pin + "' for magic link token '" + secret + "'"); } if (auth._offered) {