superbig/craft3-restrict

此包已被废弃且不再维护。作者建议使用 verbb/knock-knock 包代替。

基于IP白名单限制CP访问

安装次数: 8,716

依赖项: 0

建议者: 0

安全: 0

星标: 8

关注者: 2

分支: 2

开放问题: 4

类型:craft-plugin

2.0.3 2019-04-03 11:31 UTC

This package is auto-updated.

Last update: 2022-07-14 19:26:38 UTC


README

注意:此插件已被废弃。请使用 Knock Knock 作为替代。

Craft CMS 3.x的Restrict插件

基于IP白名单限制CP访问

Screenshot

要求

此插件需要Craft CMS 3.0.0-beta.23或更高版本。

安装

要安装此插件,请按照以下说明操作。

  1. 打开您的终端并转到您的Craft项目目录

     cd /path/to/project
    
  2. 然后告诉Composer加载插件

     composer require superbig/craft3-restrict
    
  3. 在控制面板中,转到设置→插件,并点击“安装”按钮以安装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

  1. 将示例配置文件 restrict.php 复制到Craft的配置文件夹中,默认为 craft/config
  2. 添加您希望允许访问CP的IP,并根据需要更改其他设置。

Superbig 提供