lahirulhr / nova-lock-screen
A simple lock screen for laravel nova.
Installs: 2 887
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ^7.3|^8.0
README
The lock screen is a simple security feature that works as locking overlay over the NOVA dashboard. If the user is idle for given timeout, the lockscreen will be activated automatically. Then the user needs to enter login password again to continue their session.
View
How to use
-
Run composer
composer require lahirulhr/nova-lock-screen
to install the package -
Publish config (Optional)
php artisan vendor:publish --tag="nova-lock-screen.config"
-
Use
LockScreen
trait in User model
use Lahirulhr\NovaLockScreen; class User extends Model { use LockScreen; // ... }
- Register the Tool in Nova service provider
use Lahirulhr\NovaLockScreen\NovaLockScreen; public function tools() { return [ // ... , new NovaLockScreen, ]; }
- Register middleware in
nova.php
'middleware' => [ // ... , \Lahirulhr\NovaLockScreen\Http\Middleware\LockScreen::class, ],
- Done
Config
<?php // config for Nova Lock Screen return [ // master lock 'enabled' => true, // auth guard for lock screen 'guard' => 'web', // if user has been inactive for this long time, the app will be locked 'lock_timeout' => 15, // second // default background image for lock screen 'background_image' => 'https://magnificentsrilanka.com/wp-content/uploads/2022/01/sigiriya-from-pidurangala-1.jpg', // these urls are not locked by lock screen 'excluded_urls' => [ // ], // set custom url for lock screen 'lock_url' => 'nova-lock-screen', ];
Set custom background image per user
you can override default background image by overriding getLockScreenImage()
method in User model
public function getLockScreenImage():String { return 'url\to\image.jpg'; }
Enable/Disable lock screen per user
use lockScreenEnabled()
method to override default lock status settings
public function lockScreenEnabled():bool { return false; }
Set locking timeout per user
use lockScreenTimeout()
method to override default lock status settings
public function lockScreenTimeout():int { return 60*10; // seconds }
Customizing the lock screen
The lock screen page is built with Blade views. You can copy them into your resource directory by running php artisan vendor:publish --tag="nova-lock-screen.views"
command
then customize them as you want.
Credits
License
The MIT License (MIT). Please see License File for more information.