Prefer url over domain

This commit is contained in:
Kgothatso 2019-12-01 00:08:06 +02:00
parent 385a4cedbb
commit 19dd5a2a9d

View File

@ -12,8 +12,8 @@ module.exports.builder = (yargs) => {
describe: 'challenge that needs to be signed', describe: 'challenge that needs to be signed',
type: 'string' type: 'string'
}) })
.option('domain-url', { .option('url', {
describe: 'override domain url belong to the service making the challenge', describe: 'override url belong to the service making the challenge',
type: 'string' type: 'string'
}) })
.option('user-identifier', { .option('user-identifier', {
@ -28,17 +28,17 @@ module.exports.handler = (argv) => {
const challenge = JSON.parse(argv.challenge); const challenge = JSON.parse(argv.challenge);
// TODO get userIdentifier and domainUrl from challenge // TODO get userIdentifier and domainUrl from challenge
const loginRequest = JSON.parse(challenge.message); const loginRequest = JSON.parse(challenge.message);
const domainUrl = argv.domainUrl || loginRequest.domainUrl; const url = argv.url || loginRequest.url;
const userIdentifier = argv.userIdentifier || loginRequest.userIdentifier; const userIdentifier = argv.userIdentifier || loginRequest.userIdentifier;
persistence().LoadDB() persistence().LoadDB()
.then(db => { .then(db => {
console.log("Looking for"); console.log("Looking for");
console.log("url: ", domainUrl); console.log("url: ", url);
console.log("userIdentifier: ", userIdentifier); console.log("userIdentifier: ", userIdentifier);
return db.Lock.findOne({ return db.Lock.findOne({
where: { where: {
url: domainUrl, url: url,
userIdentifier: userIdentifier userIdentifier: userIdentifier
}, },
include: [ include: [