~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH meta.sr.ht] URL encode TOTP QR code URI

Details
Message ID
<20180724165151.4353-1-fkooman@tuxed.net>
Sender timestamp
1532451111
DKIM signature
missing
Download raw message
Patch: +3 -2
For QR code readers built in to TOTP applications like FreeOTP, the
"label" needs to be URL encoded [0].

FreeOTP for iOS was unable to import the TOTP QR code generated by
meta.sr.ht.

This is a fix for [1].

[0] https://github.com/google/google-authenticator/wiki/Key-Uri-Format
[1] https://todo.sr.ht/%7Esircmpwn/meta.sr.ht/47
---
 metasrht/blueprints/security.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/metasrht/blueprints/security.py b/metasrht/blueprints/security.py
index cf287a7..3b13651 100644
--- a/metasrht/blueprints/security.py
+++ b/metasrht/blueprints/security.py
@@ -9,6 +9,7 @@ from metasrht.qrcode import gen_qr
from srht.validation import Validation, valid_url
from srht.config import cfg
from srht.database import db
from urllib.parse import quote
import base64
import os

@@ -41,8 +42,8 @@ def security_audit_log_GET():

def totp_get_qrcode(secret):
    return gen_qr("otpauth://totp/{}:{}?secret={}&issuer={}".format(
        site_name, "{} <{}>".format(current_user.username,
            current_user.email), secret, site_name))
        quote(site_name), quote("{} <{}>".format(current_user.username,
            current_user.email)), secret, quote(site_name)))

@security.route("/security/totp/enable")
@loginrequired
-- 
2.17.1
Details
Message ID
<20180724222616.GA11525@homura.localdomain>
In-Reply-To
<20180724165151.4353-1-fkooman@tuxed.net> (view parent)
Sender timestamp
1532471177
DKIM signature
missing
Download raw message
Thanks for the patch! I've applied it and will be deploying it shortly.
Details
Message ID
<d5976cff-7077-d6ff-2756-385fc94aa1bf@tuxed.net>
In-Reply-To
<20180724222616.GA11525@homura.localdomain> (view parent)
Sender timestamp
1532591407
DKIM signature
missing
Download raw message
On 07/25/2018 12:26 AM, Drew DeVault wrote:
> Thanks for the patch! I've applied it and will be deploying it shortly.

Thanks so much! It works now!

Cheers,
François
Reply to thread Export thread (mbox)