Support Auth0.
[readifood.git] / www / login.php
deleted file mode 120000 (symlink)
index 0012f7d2344777b9c670a71722eb0930093ce57f..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-index.php
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..a9f9d22802021ce2673a84450a7bee5020e5e102
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+  $root = join(DIRECTORY_SEPARATOR, array($_SERVER['DOCUMENT_ROOT'], ".."));
+  $lib_root = join(DIRECTORY_SEPARATOR, array($root, "lib"));
+  require_once(join(DIRECTORY_SEPARATOR, array($root, "vendor", "autoload.php")));
+  include_once(join(DIRECTORY_SEPARATOR, array($lib_root, "auth0.php")));
+
+  if (isset($_GET['code'])) {
+    try {
+      $auth0->getUser();
+      header("Location: https://" . $_SERVER['HTTP_HOST'] . "/");
+      exit;
+    }
+    catch (\Exception $e) {
+    }
+  }
+
+?>