From afe0b7d821780f712fd271c8f957bb6311470ac5 Mon Sep 17 00:00:00 2001 From: Evguenia degtiareva Date: Wed, 10 Jul 2019 11:04:40 -0700 Subject: [PATCH] Use Url to construct wallet url in login --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 53575e31..758b280e 100755 --- a/index.js +++ b/index.js @@ -110,9 +110,12 @@ exports.login = async function(options) { if (!options.walletUrl) { console.log("Log in is not needed on this environment. Please use appropriate master account for shell operations.") } else { - const title = 'Near Shell'; + const newUrl = new URL(options.walletUrl); + const title = 'NEAR Shell'; + newUrl.searchParams.set('title', title); const keyPair = await KeyPair.fromRandom('ed25519'); - console.log(`Please navigate to this url and follow the insturctions to log in: ` + - `${options.walletUrl}/login/?title=${title}&public_key=${keyPair.getPublicKey()}&account_id=${options.accountId}`); + newUrl.searchParams.set('public_key', keyPair.getPublicKey()); + newUrl.searchParams.set('account_id', options.accountId) + console.log(`Please navigate to this url and follow the insturctions to log in: ${newUrl.toString()}`); } }