From 125dca65f5b090a9a6ee8c15fef721bc5dadc725 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 23 Oct 2015 01:46:04 -0700 Subject: [PATCH] yes, use encodeURI --- test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.js b/test.js index 57af0af..ebade39 100644 --- a/test.js +++ b/test.js @@ -15,21 +15,23 @@ function generate(ke) { var companyName = $('.js-company-name').value; var userAccount = $('.js-user-account').value; - /* var otpauth = 'otpauth://totp/' + encodeURI(companyName) + ':' + encodeURI(userAccount) + '?secret=' + key.replace(/\s+/g, '').toUpperCase() ; + /* var otpauth = encodeURI('otpauth://totp/' + companyName + ':' + userAccount + '?secret=') + key.replace(/\s+/g, '').toUpperCase() ; */ // TODO figure out the right escaping + /* var otpauth = 'otpauth://totp/' + companyName + ':' + userAccount + '?secret=' + key.replace(/\s+/g, '').toUpperCase() ; + */ // obviously don't use this in production, but it's not so bad for the demo var src = 'https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=' + encodeURIComponent(otpauth);