【发布时间】:2018-08-28 00:20:47
【问题描述】:
我想自定义 web2py 的two-step verification 形式。我阅读了this 问题,该问题解释了如何自定义有用的普通身份验证表单,但我仍然不知道如何在第二步(提交验证码)中使用自定义表单。有谁知道如何做到这一点或已经成功了? 我希望有人可以提供帮助。
【问题讨论】:
标签: python html css web2py two-factor-authentication
我想自定义 web2py 的two-step verification 形式。我阅读了this 问题,该问题解释了如何自定义有用的普通身份验证表单,但我仍然不知道如何在第二步(提交验证码)中使用自定义表单。有谁知道如何做到这一点或已经成功了? 我希望有人可以提供帮助。
【问题讨论】:
标签: python html css web2py two-factor-authentication
要确定您是否处于登录过程的第二步,您可以检查session.auth_two_factor_user 的值(在第二步中它将有一个值,否则为None)。因此,在user.html 视图中,您可以包含如下条件逻辑:
{{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}}
【讨论】: