menu Chancel's blog
rss_feed
Chancel's blog
时来天地皆同力

Flask二次登录实现代码

作者:Chancel Yang, 时间:2021 Jun 15, 阅读:37

Python二次登录验证的实现,依赖于pyotp包

import pyotp

sec = pyotp.random_base32()
totp = pyotp.totp.TOTP(sec,interval=60)
qr_code_text = totp.provisioning_uri(name='Chancel.Yang', issuer_name='Secure App')
print('登录二次验证器创建成功,二维码数据->%s' % qr_code_text)

# 可选:生成验证码步骤
import qrcode
img = qrcode.make(qr_uri)
img.get_image().show()

[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]