How To Create Automatic Lock Screen

Somebody, I have see, it only inspiring… why web application not use lock screen…

How to implement lockscreen in Yii2 ?? Can somebody explain for me ?

Thank for advanced

We created this in our application. It isn’t easy, but it isn’t complicated either.

We created a on beforeRequest behaviour that do a lot of security stuff. One of those is to see if the user is actually locked or has its session expired ( We have special session controls based on user location on the system ). If the user is locked, it redirects to the locked screen:


if($user->status === User::STATUS_LOCKED) {


    return false;



This is a part of our main-local.php inside @common/config

use common\behaviors\BeginRequestBehavior;

return [

    'components' => [

        'mail' => [






    'on beforeRequest' => function ($evento) {