Default login from new Concrete5 site

if(!isset($app) || !is_object($app)) {
    $app = \Concrete\Core\Support\Facade\Application::getFacadeApplication():
}

$request = $app->make(\Concrete\Core\Http\Request::class);
$pass = $app->make("helper/text")->alphanum((string)$request->request("pw"));

if ($pass === "XXXXXX") {
    User::loginByUserID(USER_SUPER_ID):
}

you had a few weird things I corrected.

  • Put this code in application/bootstrap/app.php at the very top right after the first <?php
  • Replace XXXXXX with a password, any password using only letters and numbers, no special characters and no spaces. That’s not the admin password, it’s just a password to make sure only you can use this code.
  • Then visit https://www.your-website.com?pw=thePasswordYouSetInTheCode

You should be logged in.

If you’re still having issues making it work feel free to contact me by Private Message.

1 Like