roelvanhintum/craft-twofactorauthentication
Composer 安装命令:
composer require roelvanhintum/craft-twofactorauthentication
包简介
Craft 4 plugin for two-factor or two-step login using Time Based OTP.
关键字:
README 文档
README
Two-Factor Authentication
Craft 4 plugin for two-factor or two-step login using Time Based OTP (TOTP, like Google Authenticator). Every user can setup TOTP themselves, the plugin does not force users. Admins can list usage in user tables.
Inner working
Login works as usual for users without 2-factor auth.
When enabled, the user is redirected to the 2-factor verification page after login. This means the user is already logged in. When the user tries to visit an other Control Panel page than the public ones before verification, the logout is triggered. This blocks the user from visiting the CP unverified.
Requirements
- Craft 4.0.0 and up
- PHP 8.1 and up
Setting up back end 2FA
- Set
verifyBackEndtotruein the config file (this is the default). - Set
forceBackEndtotrueif you want to prevent users from accessing the control panel without first enabling 2FA.
Setting up front end 2FA
When using a login for front end users, the following steps add 2FA support.
- Copy the two-factor-authentication.php file to your
config/folder. - Set
verifyFrontEndtotruein the config file. - Define what urls should be protected with 2FA verification. Choose between using the
frontEndPathAlloworfrontEndPathExclude! Using both will block everything! See config for additional info. - Build a 2FA login-verify form accessible by url like the example twig.
- Set the
verifyPath. For ourlogin-verify.twigexample the path would belogin-verify. - Allow users setting up 2FA in front end by building a template like the example twig.
- Set the
settingsPath. For ourtwo-factor-settings.twigexample the path would betwo-factor-settings.
Setting up config
Copy the two-factor-authentication.php file to your config/ folder.
Resetting a user's 2FA
Simply remove the user's twofactorauthentication_user record. This disables 2FA for that user.
Screens
Setting screen when turning 2FA on
Setting screen when turning 2FA off
Login verification screen
roelvanhintum/craft-twofactorauthentication 适用场景与选型建议
roelvanhintum/craft-twofactorauthentication 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 36, 最近一次更新时间为 2025 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Authentication」 「login」 「two-factor」 「Two-factor Authentication」 「two-step」 「craftcms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 roelvanhintum/craft-twofactorauthentication 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 roelvanhintum/craft-twofactorauthentication 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 roelvanhintum/craft-twofactorauthentication 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
Filament Two Factor Authentication: Google 2FA + Passkey Authentication
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Novactive eZ 2FA Bundle is an Ibexa bundle that provides two-factor authentication for your Ibexa project
统计信息
- 总下载量: 27
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 36
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-13


