wagtail的双因素认证

wagtail-2fa的Python项目详细描述


这个django应用程序添加了对wagtail的双因素身份验证。幕后 它使用django-otp支持基于时间的一次性密码(totp)。这个 允许您使用各种应用程序,如authy、google authenticator或 1密码。

安装

pip install wagtail-2fa

然后将以下行添加到django中的INSTALLED_APPS列表中 设置:

INSTALLED_APPS=[# ...'wagtail_2fa','django_otp','django_otp.plugins.otp_totp',# ...]

迁移数据库:

python manage.py migrate

接下来将所需的中间件添加到MIDDLEWARE。它应该来了 认证中间件之后:

MIDDLEWARE=[# .. other middleware# 'django.contrib.auth.middleware.AuthenticationMiddleware','wagtail_2fa.middleware.VerifyUserMiddleware',# 'wagtail.core.middleware.SiteMiddleware',# .. other middleware]

设置

以下设置可用(通过Django设置设置):

  • ^{tt3}$ (default ^{tt4}$): When set to True all staff, superuser and other users with access to the Wagtail Admin site are forced to login using two factor authentication.
  • ^{tt5}$ (default: ^{tt6}$): The uWSGI mount point that Wagtail is running at. Ex. ^{tt7}$
  • ^{tt8}$ (default: ^{tt4}$): The issuer name to identify which site is which in your authenticator app. If not set and ^{tt10}$ is defined it uses this. sets ^{tt11}$ under the hood.

沙箱

首先用python 3.6.1创建一个新的virtualenv并激活它。那就跑吧 以下命令:

  • make sandbox

然后您可以访问http://localhost:8000/admin/并使用以下命令登录 凭证:

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么stripVersion不能在带有mojo依赖项的mavendependencyplugin上工作   java存储具有不同功能的大量对象   java Spring MockMvc自定义验证器未在Spring容器中注册/调用   javascript程序编辑实体而不是添加   C++如何在java上检索图形卡信息?   java如何在没有方法参数的方法上使用@cacheable注释的键   java如何获取特定用户或学生的JSON   java可序列化AjaxRequestTarget   java Tomcat 8禁用分块编码过滤器   java这个简单的Swingbase类是线程安全的吗?   java调用Gdi32。使用JNA获取对象   如何使用来自其他类Java Android onClick的方法?   json序列化已经有了id(java.lang.String)的POJO   java使用jsp上传多个文件?   java有没有办法为Android项目在EclipseIndigo上设置JVM参数?   Eclipse中的java,为什么它告诉我添加一个已经存在的分号?   Java中的正则表达式拆分行   Java:在单行中赋值