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