Coder Social home page Coder Social logo

valpuia / filament-lockscreen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marjose123/filament-lockscreen

0.0 0.0 0.0 551 KB

A filament plugin that will allow to lock your app screen and be able to continue working after re-login, the same with your computer/laptop.

License: MIT License

PHP 88.19% Blade 11.81%

filament-lockscreen's Introduction

Give an ability to the user to lock their access without logging out of the system for a break.

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require marjose123/filament-lockscreen

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-lockscreen-views"

Add this middleware Locker::class to your Filament Config and you're ready to go

// use lockscreen\FilamentLockscreen\Http\Middleware\Locker;

    'middleware' => [
        'auth' => [
          //....
            Locker::class,
        ],
       // .....
    ],
Config file:
return [

    /*
     *  Lock Screen Icon
     */
    'icon' => 'heroicon-s-lock-closed',

    /*
     *  Lock Screen URL
     * 
     * Note: do not provide base url `/` or empty, otherwise it will return default url
     */
    'url' => '/screen/lock',

    /*
    | ------------------------------------------------------------------------------------------------
    |   Table Column Name
    | ------------------------------------------------------------------------------------------------
    | Change the table column name if your login authentication column is checking on a different field and not on the default field ('email and password') column of the table.
    */
    'table_columns' => [
        'account_username_field' => 'email',
        'account_password_field' => 'password',
    ],

    /* =======================================
     *   if `enable_redirect_to` is TRUE then after login, it will be redirected to the route setup under `redirect_route`
     */
    'enable_redirect_to' => false,
    'redirect_route' => 'filament.pages.dashboard',

    /* =======================================
    *   RATE LIMIT
     *  change to false the `enable_rate_limit` to disable preventing user to input after several login failure.
    */
    'rate_limit' => [
        'enable_rate_limit' => true,
        'rate_limit_max_count' => 5, // max count for failure login allowed.
        'force_logout' => false,
    ],
    /* =========================
    *  Path segmentation locking
    *  e.g., if the segment is enabled then locked_path = ['admin', 'employee']
    *  www.domain.com/admin/ <== Locked, because this segment path is added to the locked_path
    *  www.domain.com/employee/ <== Locked, because this segment path is added to the locked_path
    *  www.domain.com/portal/ <== unlocked and will not be checked by the locker middleware even if the user lock their screen
    *
    * Note: make sure your segment_needle and allowed path is aligned
    */
    'segment' => [
        'specific_path_only' => false, // if false, then all the request will be blocked by the locker and will be redirected to the authentication page
        'segment_needle' => 1, // see the https://laravel.com/api/9.x/Illuminate/Http/Request.html#method_segment
        'locked_path' => [], //
    ],
];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

If you want to contribute to Filament-lockerscreen packages, you may want to test it in a real Laravel project:

  • Fork this repository to your GitHub account.
  • Create a Laravel app locally.
  • Clone your fork in your Laravel app's root directory.
  • In the /filament-lockscreen directory, create a branch for your fix, e.g. fix/error-message.

Install the packages in your app's composer.json:

{
   // ...
    "require": {
        "marjose123/filament-lockscreen": "*",
    },
    "repositories": [
        {
            "type": "path",
            "url": "filament-lockscreen"
        }
    ],
   // ...
}

Now, run composer update.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

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.