python - Web2Py:自定义两步验证表单

标签 python html css web2py two-factor-authentication

我想自定义 two-step verification web2py 的形式。我读了this问题解释了如何自定义有用的普通身份验证表单,但我仍然不知道如何在第二步(提交验证码)中使用自定义表单。有谁知道如何做到这一点或已经成功做到这一点? 我希望有人能提供帮助。

最佳答案

要确定您是否处于登录过程的第二步,您可以检查 session.auth_two_factor_user 的值(它在第二步时会有值,但为 None 否则)。因此,在 user.html View 中,您可以包含如下条件逻辑:

{{if request.args(0) == 'login':}}
  {{if not session.auth_two_factor_user:}}
  [Custom first step login form]
  {{else:}}
  [Custom second step code verification form]
  {{pass}}
{{pass}}

关于python - Web2Py:自定义两步验证表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49362988/

相关文章:

javascript - 如何使网页中的表格垂直滚动,同时使其他所有内容固定在适当的位置

html - 响应式滚动 div 高度

optimization - 删除 HTML Canvas alpha channel

python - 关于用于 Keras fit_generator 的 python 数据生成器的混淆

python - 从列表中获取素数

python - 实现 cdc 但在 Python Pandas 中出现值错误

javascript - 如何传递使用 XMLHttpRequest 上传的图片?

python - xlrd 无法读取从电子邮件附件下载的 xlsx 文件

css - 缩放html页面时的滚动条

javascript - Bootstrap 丸中的 JQuery LightSlider