yes, use encodeURI
This commit is contained in:
parent
50e047fae4
commit
125dca65f5
4
test.js
4
test.js
|
@ -15,21 +15,23 @@ function generate(ke) {
|
||||||
var companyName = $('.js-company-name').value;
|
var companyName = $('.js-company-name').value;
|
||||||
var userAccount = $('.js-user-account').value;
|
var userAccount = $('.js-user-account').value;
|
||||||
|
|
||||||
/*
|
|
||||||
var otpauth = 'otpauth://totp/'
|
var otpauth = 'otpauth://totp/'
|
||||||
+ encodeURI(companyName) + ':' + encodeURI(userAccount)
|
+ encodeURI(companyName) + ':' + encodeURI(userAccount)
|
||||||
+ '?secret=' + key.replace(/\s+/g, '').toUpperCase()
|
+ '?secret=' + key.replace(/\s+/g, '').toUpperCase()
|
||||||
;
|
;
|
||||||
|
/*
|
||||||
var otpauth = encodeURI('otpauth://totp/'
|
var otpauth = encodeURI('otpauth://totp/'
|
||||||
+ companyName + ':' + userAccount
|
+ companyName + ':' + userAccount
|
||||||
+ '?secret=') + key.replace(/\s+/g, '').toUpperCase()
|
+ '?secret=') + key.replace(/\s+/g, '').toUpperCase()
|
||||||
;
|
;
|
||||||
*/
|
*/
|
||||||
// TODO figure out the right escaping
|
// TODO figure out the right escaping
|
||||||
|
/*
|
||||||
var otpauth = 'otpauth://totp/'
|
var otpauth = 'otpauth://totp/'
|
||||||
+ companyName + ':' + userAccount
|
+ companyName + ':' + userAccount
|
||||||
+ '?secret=' + key.replace(/\s+/g, '').toUpperCase()
|
+ '?secret=' + key.replace(/\s+/g, '').toUpperCase()
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
// obviously don't use this in production, but it's not so bad for the demo
|
// 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);
|
var src = 'https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=' + encodeURIComponent(otpauth);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue