nccgroup / opinel

Python code shared by Scout2 and AWS-Recipes
GNU General Public License v2.0
24 stars 18 forks source link

Try harder to display the qr code, including trying web browsers. #3

Closed philsnow closed 9 years ago

philsnow commented 9 years ago

I'm working on getting the MFA setup to be more streamlined, and that involves not depending transitively on PIL.

See https://github.com/jart/fabulous/blob/bc6de0f4414cebb4a13f6604c5a2797862e0439d/fabulous/utils.py#L129-L138 to see that even the fabulous dev(s) don't really recommend it. The links for OS X that they give go here: http://pythonmac.org/packages/py25-fat/index.html , note that these .dmg files are not serveable over https.

So, this patch provides some fallbacks in case fabulous (or PIL) is either not installed or doesn't work.

1) try fabulous.image

2) if that's not importable, try using a web browser (with a heuristic for which browsers are "graphical")

3) if that's not available, tell the user the path to the png file so they can grab it through other means

4) also print the actual base32-encoded seed; the user can type this in manually.

philsnow commented 9 years ago

oh forgot to mention, I tried out both typing in the b32-encoded seed into google authenticator and also scanning the barcode for the same seed, and verified that I got the same OTPs out at the end.

philsnow commented 9 years ago

@l01cd3v , @-ing you in case you don't have notifications set for this repo

l01cd3v commented 9 years ago

Thanks, got the notifications setup but was really busy last week. Will have a look at it today !

philsnow commented 9 years ago

Thanks!

philsnow commented 9 years ago

github needs a safety on the "close and comment" button, why is it even next to the comment button

l01cd3v commented 9 years ago

Many thanks for that PR !