mdmsoft/yii2-action-filter

Force entry code to enter

Installs: 1 738

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 5

Forks: 7

Open Issues: 0

Type:yii2-extension

1.0.1 2014-11-04 08:08 UTC

This package is not auto-updated.

Last update: 2024-12-17 05:12:29 UTC


README

Force entry code to enter to the action.

Installation

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.

Usage

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',
        ...