superbig / craft3-restrict
2.0.3
2019-04-03 11:31 UTC
Requires
- craftcms/cms: ^3.0.0
- dxw/cidr: ^3.0
This package is auto-updated.
Last update: 2022-07-14 19:26:38 UTC
README
注意:此插件已被废弃。请使用 Knock Knock 作为替代。
Craft CMS 3.x的Restrict插件
基于IP白名单限制CP访问
要求
此插件需要Craft CMS 3.0.0-beta.23或更高版本。
安装
要安装此插件,请按照以下说明操作。
-
打开您的终端并转到您的Craft项目目录
cd /path/to/project
-
然后告诉Composer加载插件
composer require superbig/craft3-restrict
-
在控制面板中,转到设置→插件,并点击“安装”按钮以安装Restrict。
配置Restrict
<?php return [ 'enabled' => true, // Add any IPs you want to be able to access the CP. You can also use CIDR notation such as 192.168.0.0/24 'ipWhitelist' => [ '::1', '127.0.0.1' ], // Logged in admins can bypass the whitelist 'allowAdmins' => true, // By default, the plugin will throw a exception if the IP isn't in the whitelist // If you want to redirect to an url instead, set it here 'redirectUrl' => null, // Or you want to render a template, set it here 'template' => null ];
使用Restrict
- 将示例配置文件
restrict.php
复制到Craft的配置文件夹中,默认为craft/config
。 - 添加您希望允许访问CP的IP,并根据需要更改其他设置。
由 Superbig 提供