be more specific with your feedback, please (and fix missing email addr)

This commit is contained in:
AJ ONeal 2018-06-27 20:26:45 +00:00
parent 589e4af90b
commit 7fd28d55a1
1 changed files with 8 additions and 2 deletions

View File

@ -156,12 +156,14 @@ module.exports.pairRequest = function (opts) {
, aud: state.config.webminDomain , aud: state.config.webminDomain
, iat: Math.round(now / 1000) , iat: Math.round(now / 1000)
, id: authReq.id , id: authReq.id
, sub: authReq.subject
, pin: pin , pin: pin
, hostname: authReq.hostname , hostname: authReq.hostname
}; };
auth = { auth = {
id: authReq.id id: authReq.id
, secret: authReq.secret , secret: authReq.secret
, subject: authReq.subject
, pin: pin , pin: pin
, dt: now , dt: now
, exp: now + (2 * 60 * 60 * 1000) , exp: now + (2 * 60 * 60 * 1000)
@ -179,10 +181,14 @@ module.exports.pairPin = function (opts) {
return state.Promise.resolve().then(function () { return state.Promise.resolve().then(function () {
var pin = opts.pin; var pin = opts.pin;
var secret = opts.secret; var secret = opts.secret;
var auth = Auths.getBySecretAndPin(secret, pin); var auth = Auths.getBySecret(secret);
if (!auth) { 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) { if (auth._offered) {