From db8593e062169fd9f9a845abdbdcb8adcb673231 Mon Sep 17 00:00:00 2001
From: zolij <zolij86@gmail.com>
Date: Tue, 15 Jul 2014 13:48:36 +0200
Subject: [PATCH] 
 https://git.sch.bme.hu/kszk/authsch-client/commit/7ba7fa64128fafe050e5beeffe842425c719a75a#note_239
 https://git.sch.bme.hu/kszk/authsch-client/commit/7ba7fa64128fafe050e5beeffe842425c719a75a#note_240

---
 php/AuthSCHClient.class.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/php/AuthSCHClient.class.php b/php/AuthSCHClient.class.php
index 7d3a7ab..b280caa 100644
--- a/php/AuthSCHClient.class.php
+++ b/php/AuthSCHClient.class.php
@@ -10,7 +10,7 @@ class AuthSCHClient {
     private $tokens;
     
     public function __construct($tokens = null) {
-        $this->tokens = new stdClass();
+        $this->tokens = new \stdClass();
         
         if($tokens === null) {
             if(session_id() == '') {
@@ -73,10 +73,12 @@ class AuthSCHClient {
             $res = json_decode($ch);
             
             // check api access & redirect to auth.sch.bme.hu for authorization
-            if ($res != null && isset($res->success) && $res->success == true)
+            if ($res != null && isset($res->success) && $res->success == true) {
                 header("Location: " . self::$host . "site/login?response_type=code&client_id=". self::$username ."&state=" . sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']) . "&scope=" . self::$scope);
-            else
+		die();
+            } else {
                 throw new Exception("error during api check");
+	    }
         } else {
             $data = array(
                 'grant_type'=>'authorization_code',
@@ -98,4 +100,4 @@ class AuthSCHClient {
         return json_decode(file_get_contents(self::$host . 'api/profile/?access_token=' . $this->tokens->access_token));
     }
     
-}
\ No newline at end of file
+}
-- 
GitLab