2017 © Pedro Peláez
 

library lockscreen

Add Lockscreen in laravel

image

rangoo/lockscreen

Add Lockscreen in laravel

  • Wednesday, December 6, 2017
  • by Guja1501
  • Repository
  • 3 Watchers
  • 13 Stars
  • 159 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 49 % Grown

The README.md

Lockscreen

Donate Latest Stable Version Total Downloads License, (*1)

rangoo/lockscreen is Package for Laravel on Packagist, (*2)

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system., (*3)

Installing

composer require rangoo/lockscreen

Help

Lockscreen Middlewares auth.locked and auth.unlocked is extended to auth Middleware, (*4)

auth.locked middleare means that user must be locked, (*5)

auth.unlocked middleware means that user must be unlocked, (*6)

Both of them means user must be logged in., (*7)

Examples

Rangoo\Lockscreen\Traits\LockscreenMethods, (*8)

// Controller

use Illuminate\Routing\Controller;
use Rangoo\Lockscreen\Traits\LockscreenMethods;

class LockscreenController extends Controller {
    use LockscreenMethods;
}
// Routes

// Init routes for lockscreen methods
Route::get('/lockscreen', 'LockscreenController@lockscreen')->middleware('auth.locked');
Route::post('/lockscreen', 'LockscreenController@lock')->middleware('auth.unlocked');
Route::delete('/lockscreen', 'LockscreenController@unlock')->middleware('auth.locked');

// If any guard: 'auth.unlocked:guard1,guard2,guard3'
Route::middleware('auth.unlocked')->group(function(){
  // Routes goes here
  // Where must be logged in and unlocked
});

auth.lock blade, (*9)

<form action="{{ url('/lockscreen') }}" method="post">
   {{ csrf_field() }}
   <h3>{{ auth()->user()->name }}, are you here?</h3>
   <input type="password" name="password"/>
   <input type="submit" value="Unlock" />
</form>

layout blade, (*10)

<html>
  <head>
    <script>
      window.Lockscreen = {
        locked: {{ session()->get('lockscreen', false) }},
        route: '{{ url('/lockscreen') }}',
      };
    </script>
  </head>
  <body>

    <!-- include javascript -->
  </body>
</html>

webpack, (*11)

In this example using packages: SensorAFK, axios, (*12)

const SensorAFK = require('sensor-afk');
const axios = require('axios');

if(!window.Lockscreen.locked){
  new SensorAFK({
    callback: () => {
      axios.post(window.Lockscreen.route)
        .then(() => {
          location.reload();
        })
        .catch(() => {
          alert('something went wrong');
        });
    }
  });
}

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository., (*13)

Authors

See also the list of contributors who participated in this project., (*16)

License

This project is licensed under the MIT License - see the LICENSE file for details, (*17)

The Versions

06/12 2017

dev-master

9999999-dev https://github.com/guja1501/lockscreen

Add Lockscreen in laravel

  Sources   Download

MIT

The Requires

 

by Guja Babunashvili

laravel lockscreen

09/09 2017

v1.0.1

1.0.1.0 https://github.com/guja1501/lockscreen

Add Lockscreen in laravel

  Sources   Download

MIT

The Requires

 

by Guja Babunashvili

laravel lockscreen

09/09 2017

v1.0.0

1.0.0.0 https://github.com/guja1501/lockscreen

Add Lockscreen in laravel

  Sources   Download

MIT

The Requires

 

by Guja Babunashvili

laravel lockscreen