-
-
Save katzueno/dc59654f37f40b8e005c06636f17ce4f to your computer and use it in GitHub Desktop.
#concrete5 [v7] Hide login page by ip address
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
<?php | |
namespace Application\Controller\SinglePage; | |
use Concrete\Core\Http\Request; | |
use Concrete\Core\Http\Response; | |
use Core; | |
class Login extends \Concrete\Controller\SinglePage\Login | |
{ | |
public function on_start() | |
{ | |
$request = Request::getInstance(); | |
$ip = $request->getClientIp(); | |
if ($ip != '127.0.0.1') { | |
$cnt = Core::make('\Concrete\Controller\Frontend\PageNotFound'); | |
$v = $cnt->getViewObject(); | |
$contents = $v->render(); | |
$response = new Response($contents, 403); | |
$response->send(); | |
Core::shutdown(); | |
} | |
parent::on_start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment