Coder Social home page Coder Social logo

craft-gatekeeper's Introduction

Gatekeeper plugin for Craft CMS 3.x

Protect your Craft CMS website from access with a universal password.

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require tomdiggle/craft-gatekeeper
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Gatekeeper.

Configure

To congifure the plugin, follow these instructions.

  1. In the Control Panel, go to Settings → Plugins and click the Gatekeeper icon.

  2. Then enter the password required to access the website and click save.

License

The MIT License (MIT). Please see License File for more information.

Brought to you by Tom Diggle

craft-gatekeeper's People

Contributors

boscho87 avatar inbn avatar st-mcd avatar tomdiggle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

craft-gatekeeper's Issues

Gatekeeper should redirect back to initial requested page

When accessing a page other than the homepage, Gatekeeper asks for the password, and then redirects to the root URL. Having a redirect back to the original request would help passing specific links via Gatekeeper.

PS: Tom, really appreciate this plugin! :) Thanks for your hard work.

Whitelist by IP

It'd be helpful if we could whitelist IPs in the plugin settings. Users accessing the site from these IPs would not be prompted to enter the password.

Config option to enable/disable Gatekeeper

It would be super awesome if one could enable/disable Gatekeeper via a config option. In a staging environment I would like to have Gatekeeper enabled but locally I don’t need it.

Therefore I would use environment variables from the .env file.

return [

    "enabled" => getenv('GATEKEEPER_ENABLED'),
    "password" => getenv('GATEKEEPER_PASSWORD'),
    "notice" => '',

];

Fix Composer 2 compatibility

When installing this plugin with Composer 1, the following deprecation notice is output:

Deprecation Notice: Class tomdiggle\gatekeeper\assetbundles\Gatekeeper\GatekeeperAsset located in ./vendor/tomdiggle/craft-gatekeeper/src/assetbundles/gatekeeper/GatekeeperAsset.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.

Composer 2 was released on October 24, and is now the default version that will be installed, so it’s critical that this gets resolved ASAP, or people will start getting Class not found errors.

To fix, run the following command:

> git mv src/assetbundles/gatekeeper src/assetbundles/Gatekeeper

Then commit your change and tag a new release.

(Note that you must use the git mv command, as Git tends to not notice case-sensitive file renames otherwise.)

Error on redirect

Return value of tomdiggle\gatekeeper\Gatekeeper::redirectHelper() must be an instance of tomdiggle\gatekeeper\Response, instance of craft\web\Response returned

1. in /Volumes/dev/goodwork/pbs/vendor/tomdiggle/craft-gatekeeper/src/Gatekeeper.phpat line 179
    public function redirectHelper(string $location): Response
    {
        if (strpos($location, '/') !== 0) {
            $location = '/' . $location;
        }
        $currentSite = Craft::$app->getSites()->getCurrentSite();
        if ($currentSite->baseUrl) {
            $baseUrl = Craft::getAlias($currentSite->baseUrl);
            return Craft::$app->getResponse()->redirect(rtrim($baseUrl, '/') . $location); <---- error
        }
        return Craft::$app->getResponse()->redirect($location);
    }

I'm seeing this error after inputting the password and submitting. The page remains at /gatekeeper. Removing the URI will show the homepage.

Extra cookies options

Hello!

Would it be possible to add an option to pass extra flags for the cookie? Or at least set the secure option?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.