Created
November 18, 2016 02:55
-
-
Save hissy/12c5160411a4d8221b74e76b686348d0 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
You can use juse
$this->replace('/page_not_found');
on version 8+