diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..10280a0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/OAuth2-Client"] + path = lib/OAuth2-Client + url = https://github.com/kasperrt/OAuth2-Client.git diff --git a/lib/OAuth2-Client b/lib/OAuth2-Client new file mode 160000 index 0000000..7b2dc91 --- /dev/null +++ b/lib/OAuth2-Client @@ -0,0 +1 @@ +Subproject commit 7b2dc91100becd0c3d15de8764ad279ded0d3a58 diff --git a/www/paamelding/index.php b/www/paamelding/index.php index d82228e..5f34c3e 100644 --- a/www/paamelding/index.php +++ b/www/paamelding/index.php @@ -1,4 +1,31 @@ get_access_token(); + error_log($token); + $_SESSION['userdata'] = $oauth2 -> get_identity($token, 'https://auth.dataporten.no/userinfo'); + header('Location: http://[::1]:1080/paamelding/'); + die(); +} +if (!isset($_SESSION['userdata'])) { + $oauth2 -> redirect(); + die(); +} + +//var_export($_SESSION); +//exit; + if ($_SERVER['REQUEST_METHOD'] === 'POST') { if($_POST["firstname"] == null && $_POST["lastname"] == null && @@ -35,20 +62,16 @@ die();
- First name: - -
-
- Last name: - + Full name: +
NTNU username: - +
Email adress: - +