#1 add issuer to demo (for google auth)
This commit is contained in:
parent
66a64dae72
commit
89801a7604
|
@ -33,11 +33,18 @@ 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 algo = $('.js-totp-algo').value || 'SHA1';
|
||||||
|
var digits = parseInt($('.js-totp-digits').value, 10) || 6;
|
||||||
|
var period = parseInt($('.js-totp-period').value, 10) || 30;
|
||||||
|
|
||||||
|
var otpauth = Authenticator.generateTotpUri(key, userAccount, companyName, algo, digits, period);
|
||||||
|
/*
|
||||||
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()
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
// 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
|
||||||
// (hmm... no one has ever said those words and regretted them... TODO XXX generate QR locally)
|
// (hmm... no one has ever said those words and regretted them... TODO XXX generate QR locally)
|
||||||
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