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
, 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) {