-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed blowoff bug, migration bug and added screenshots.
- Loading branch information
Showing
5 changed files
with
50 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
* @property array $ignorables Array of controller actions and IPs to ignore | ||
* @property array $urlRules Array of rules for a UrlManger configured to pretty Url | ||
* | ||
* @author John Snook <[email protected]> The masta with a blasta | ||
* @author John Snook <[email protected]> | ||
*/ | ||
class Module extends BaseModule implements BootstrapInterface { | ||
|
||
|
@@ -69,7 +69,7 @@ class Module extends BaseModule implements BootstrapInterface { | |
/** | ||
* @var string The route to your blowoff page telling the user to pound sand | ||
*/ | ||
public $blowOff = 'visitor/blowoff'; | ||
public $blowOff = 'ipFilter/visitor/blowoff'; | ||
|
||
/** | ||
* @var string $ipInfoKey Go to https://ipinfo.io/signup for a free API key | ||
|
@@ -104,11 +104,11 @@ class Module extends BaseModule implements BootstrapInterface { | |
/** @var array The rules to be used in URL management. */ | ||
public $urlRules = [ | ||
// 'visitor/<action:\w+>' => '/ipFilter/visitor/<action>', | ||
'visitor' => '/ipFilter/visitor/index', | ||
'visitor/index' => '/ipFilter/visitor/index', | ||
'visitor/blowoff' => '/ipFilter/visitor/blowoff', | ||
'visitor/<id>' => 'ipFilter/visitor/view', | ||
'visitor/update/<id>' => 'ipFilter/visitor/update', | ||
'visitor' => 'ipFilter/visitor/index', | ||
'/visitor/index' => 'ipFilter/visitor/index', | ||
'/visitor/blowoff' => 'ipFilter/visitor/blowoff', | ||
'/visitor/<id>' => '/ipFilter/visitor/view', | ||
'/visitor/update/<id>' => '/ipFilter/visitor/update', | ||
]; | ||
|
||
/** | ||
|
@@ -129,9 +129,10 @@ public function init() { | |
*/ | ||
public function bootstrap($app) { | ||
|
||
|
||
if ($app->hasModule('ipFilter') && ($module = $app->getModule('ipFilter')) instanceof Module) { | ||
$app->getUrlManager()->addRules($this->urlRules, false); | ||
|
||
//die(json_encode($app->getUrlManager()->rules)); | ||
/** this allows me to do some importing from my old security system */ | ||
if ($app instanceof \yii\console\Application) { | ||
$this->controllerNamespace = 'johnsnook\ipFilter\commands'; | ||
|
@@ -184,7 +185,7 @@ public function metalDetector(ActionEvent $event) { | |
return true; | ||
} elseif (!$alreadyFuckingOff && $visitor->is_blacklisted) { | ||
$event->handled = true; | ||
return \Yii::$app->getResponse()->redirect([$this->blowOff, 'visitor' => $visitor])->send(); | ||
return \Yii::$app->getResponse()->redirect([$this->blowOff])->send(); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters