Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
2FA: Add issuer to QR code.
Browse files Browse the repository at this point in the history
This allows auth apps (like Google Authenticator) to indicate the site
the token is for more naturally.
  • Loading branch information
spladug committed Sep 26, 2014
1 parent 9dede4f commit 3b7b741
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions r2/r2/public/static/js/qrcode.js
Expand Up @@ -2,10 +2,14 @@
$.fn.make_totp_qrcode = function (secret) {
var form = $('#pref-otp'),
newform = $('#pref-otp-qr'),
placeholder = $('<div>'),
uri = ('otpauth://totp/' + encodeURIComponent("/u/" +
r.config.logged + " on " + r.config.cur_domain) +
'?secret=' + secret)
placeholder = $('<div>')

var username = encodeURIComponent("/u/" + r.config.logged);
var params = $.param({
"secret": secret,
"issuer": r.config.cur_domain,
});
var uri = 'otpauth://totp/' + username + '?' + params;

newform.find('#otp-secret-info').append(
placeholder,
Expand Down

0 comments on commit 3b7b741

Please sign in to comment.