Force entry code to enter to the action.
The preferred way to install this extension is through composer.
Either run
php composer.phar require mdmsoft/yii2-action-filter "~1.0"
for dev-master
php composer.phar require mdmsoft/yii2-action-filter "dev-master"
or add
"mdmsoft/yii2-action-filter": "~1.0"
to the require section of your composer.json
file.
After instalation done. Attach filter to Module or Application
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'as access' => [
'class' => 'mdm\filter\EnterCode',
'timeout' => 600, // default 300
'validationCallback' => function ($code, $actionId) {
return $code === 'bismillah';
},
'only' => [
'default/view', // actions
]
],
]
You can cutomize view of verify controler by setting property viewFile
...
'as access' => [
'class' => 'mdm\filter\EnterCode',
'viewFile' => '@your/views/verify.php',
...