luyadev / luya-module-userauth
为特定 CMS 页面区域提供用户名和密码认证系统的插件。
1.1.2
2023-12-14 09:12 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- luyadev/luya-module-admin: ^3.0|^4.0|^5.0
- luyadev/luya-module-cms: ^3.0|^4.0|^5.0
- luyadev/luya-testsuite: ^3.0
- phpstan/phpstan: ^1.7
README
LUYA 前端用户认证
为特定 CMS 页面区域提供用户名和密码认证系统。 它不包含前端新用户注册过程!
安装
- 通过 composer 安装扩展
composer require luyadev/luya-module-userauth
- 添加到配置
'modules' => [ //... 'userauthfrontend' => [ 'class' => 'luya\userauth\frontend\Module', 'useAppViewPath' => false, // When enabled the views will be looked up in the @app/views folder, otherwise the views shipped with the module will be used. ], 'userauthadmin' => 'luya\userauth\admin\Module', ],
- 以及用户组件
'components' => [ //... 'user' => [ 'class' => 'yii\web\User', 'identityClass' => 'luya\userauth\models\User', ] ],
- 运行
./luya migrate
和./luya import
命令。 - 将
userauthfrontend
模块放置在 CMS 中指定的页面上。 - 添加配置变量标识符
userauth_redirect_nav_id
,其值为步骤 5 中包含userauthfrontend
的页面。 - 可选,您可以使用变量标识符
userauth_afterlogin_nav_id
配置用户在未提供 ref url 时应重定向到的导航 ID。
使用方法
安装后,您可以通过在页面“页面属性”面板中检查 保护页面 复选框来使用用户登录来保护任何给定的页面。重要:此设置不会由子页面继承,必须为每个需要保护的页面单独设置。