mirror of
https://github.com/TrentSPalmer/flask_photo_scaling_app.git
synced 2025-02-18 13:40:55 -08:00
fix style app/auth/totp.py
This commit is contained in:
parent
5eae85ca4a
commit
bab12d33e9
@ -32,7 +32,12 @@ def enable_totp():
|
|||||||
else:
|
else:
|
||||||
flash("TOTP Code didn't validate, rescan and try again")
|
flash("TOTP Code didn't validate, rescan and try again")
|
||||||
return(redirect(url_for('prof.edit_profile')))
|
return(redirect(url_for('prof.edit_profile')))
|
||||||
return render_template('qr.html', qr=qr, form=form, title="Aunthentication Code")
|
return render_template(
|
||||||
|
'qr.html',
|
||||||
|
qr=qr,
|
||||||
|
form=form,
|
||||||
|
title="Aunthentication Code",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_totp_qr(contributor):
|
def get_totp_qr(contributor):
|
||||||
@ -40,7 +45,9 @@ def get_totp_qr(contributor):
|
|||||||
contributor.totp_key = pyotp.random_base32()
|
contributor.totp_key = pyotp.random_base32()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
totp_uri = pyotp.totp.TOTP(contributor.totp_key).provisioning_uri(name=contributor.email, issuer_name='Photo App')
|
totp_uri = pyotp.totp.TOTP(
|
||||||
|
contributor.totp_key,
|
||||||
|
).provisioning_uri(name=contributor.email, issuer_name='Photo App')
|
||||||
img = qrcode.make(totp_uri, image_factory=qrcode.image.svg.SvgPathImage)
|
img = qrcode.make(totp_uri, image_factory=qrcode.image.svg.SvgPathImage)
|
||||||
f = BytesIO()
|
f = BytesIO()
|
||||||
img.save(f)
|
img.save(f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user