verbb / knock-knock

Password protect your entire Craft website front-end with a single password
MIT License
18 stars 7 forks source link

Add ‘Bypass If In "dev" Environment’ setting (or maybe not) #25

Closed j-greig closed 4 years ago

j-greig commented 4 years ago

EDIT: build this and then realised it's doable via one line in the "config/knock-knock.php" file, d'oh! So feel free to ignore this if it wouldn't be a helpful addition, just wanted to practice my plugin dev really :)


To give people the option to skip the Knock Knock prompt when developing locally.

Handy because pulling down a copy of the Craft database from staging or elsewhere logs you out of the CP and means the next thing you see is Knock Knock.

engram-design commented 4 years ago

Yeah, I was just about to point out you can use a multi-environment config setup for this. In fact, its shown in the readme.

I'm also hesitant about using CRAFT_ENVIRONMENT == 'dev' because that's just not reliable enough. For instance, our team actually uses local as our environment variable - call it just being old-school from our Craft 2 ways. But its valid, because you might have several other instances of "dev".

j-greig commented 4 years ago

This is what happens when I try to make decisions before 7am 🤪

engram-design commented 4 years ago

Appreciate the PR though - I don't want to rain on your parade 😵

j-greig commented 4 years ago

No worries! I might try building the opposite feature of this (which I'd also find super handy) which is autologin if environment == dev/local/whatever

engram-design commented 4 years ago

Any reason the enable/disable per environment isn't a good fit?