kaoken / laravel5-private-mode by kaoken

Available in laravel5 or higher, similar to maintenance mode.
22
0
2
Package Data
Maintainer Username: kaoken
Package Create Date: 2017-05-03
Package Last Update: 2019-06-10
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:22:02
Package Statistics
Total Downloads: 22
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

laravel5-private-mode

Build Status composer version licence laravel version

Similar to the maintenance mode, Private mode can be invalidated if the user matches the permitted IP group, the password matched in the login form (when displayed), the .env file APP_ENV=testingOnly.

composer

composer require kaoken/laravel5-private-mode

Added to app\Http\Kernel.php.

    protected $middleware = [
        ...
        // add
        \Kaoken\Laravel5PrivateMode\PrivateModeMiddleware::class
    ],

Added to .env.

################################
################################
##
##  Private Mode Config
##
################################
################################
PRIVATE_MODE_VALID=true
PRIVATE_MODE_LOGIN_FORM=true
PRIVATE_MODE_IP=192.168.0.1/24,127.0.0.1
PRIVATE_MODE_PASSWORD=hoge-hoge

  • PRIVATE_SITE_VALID represents validity / invalidity of this middleware.
    • false by default.
    • true, valid
    • false, invalid
  • PRIVATE_MODE_LOGIN_FORM represents the hidden login form.
    • false by default.
    • If it is true, the login form is displayed, and if it matches the password of PRIVATE_MODE_PASSWORD, private mode will be invalidated even for IPs other than PRIVATE_SITE_SAFE_IP.
    • false, hidden
  • PRIVATE_MODE_PASSWORD
    • default, it is a random string.
    • PRIVATE_MODE_LOGIN_FORM, If true, use it.
  • PRIVATE_SITE_SAFE_IP adds an IP group for which private mode is invalidated.
    • default, 192.168.0.1/24
    • Multiple entries can be added with a comma, and it corresponds to CIDR format.

Added to resources\views\vendor

Copy and paste laravel5-private-mode\resources\views\private_mode in this directory.

  • private_mode
    • layouts
      • app.blade.php is the basic layout.
    • In the case of PRIVATE_MODE_LOGIN_FORM=false, 503.blade.php is called when PRIVATE_SITE_SAFE_IP is not applicable IP group.
    • In the case of PRIVATE_MODE_LOGIN_FORM=true, login.blade.php is called whenPRIVATE_SITE_SAFE_IP is not applicable IP group.

License

MIT