X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=www%2Findex.php;h=d88b3217651b2da70cb14326f55fb2658a026dbd;hb=ea0e53db8b5a264b6e231038815d2c350076d02a;hp=f8434a9ff4e7f4de392b25728ce024675e09dfc1;hpb=7fffb0960436ff0cc2b1fb3642f7400e015244db;p=readifood.git diff --git a/www/index.php b/www/index.php index f8434a9..d88b321 100644 --- a/www/index.php +++ b/www/index.php @@ -30,27 +30,35 @@ #echo "request: $request; module: $module; params: " . print_r($parameters, true); $http = (isset($_SERVER['HTTPS'])) ? "https" : "http"; - $username = $_SERVER['REMOTE_USER']; include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "constants.php"))); include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "functions.php"))); include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "session.php"))); + + $auth0_user = $auth0->getUser(); + if (isset($auth0_user)) $username = $auth0_user["sub"]; + else $username = null; + include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "header.php"))); - $q = new UserQuery; - $user = $q->findOneByUsername($username); - if (! $q->count()) { - echo "
User " . $_SERVER['REMOTE_USER'] . " needs an entry in the user table.
\n"; - } - else { - $user_id = $user->getContactId(); - $admin_level = $user->getAdmin(); - if ($module) { - echo "User $username needs an entry in the user table.
\n"; } + else { + $user_id = $user->getContactId(); + $admin_level = $user->getAdmin(); + if ($module) { + echo "