Skip to content

Instantly share code, notes, and snippets.

@hissy
Created November 18, 2016 02:55
Show Gist options
  • Save hissy/12c5160411a4d8221b74e76b686348d0 to your computer and use it in GitHub Desktop.
Save hissy/12c5160411a4d8221b74e76b686348d0 to your computer and use it in GitHub Desktop.
#concrete5 [v7] Hide login page by ip address
<?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();
}
}
@hissy
Copy link
Author

hissy commented Oct 14, 2020

You can use juse $this->replace('/page_not_found'); on version 8+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment