Browse Source

fix function variables
edit cookie length for organizr cookie

CauseFX 5 years ago
parent
commit
10019633be

+ 7 - 6
api/classes/organizr.class.php

@@ -145,6 +145,7 @@ class Organizr
 				$this->db = new Connection([
 					'driver' => 'sqlite3',
 					'database' => $this->config['dbLocation'] . $this->config['dbName'],
+					//'onConnect' => array('PRAGMA journal_mode=WAL'),
 				]);
 			} catch (Dibi\Exception $e) {
 				$this->db = null;
@@ -2824,11 +2825,11 @@ class Organizr
 		->identifiedBy('4f1g23a12aa', true)// Configures the id (jti claim), replicating as a header item
 		->issuedAt(time())// Configures the time that the token was issue (iat claim)
 		->expiresAt(time() + (86400 * $days))// Configures the expiration time of the token (exp claim)
-		->withClaim('username', $result['username'])// Configures a new claim, called "username"
-		->withClaim('group', $result['group'])// Configures a new claim, called "group"
-		->withClaim('groupID', $result['group_id'])// Configures a new claim, called "groupID"
-		->withClaim('email', $result['email'])// Configures a new claim, called "email"
-		->withClaim('image', $result['image'])// Configures a new claim, called "image"
+		//->withClaim('username', $result['username'])// Configures a new claim, called "username"
+		//->withClaim('group', $result['group'])// Configures a new claim, called "group"
+		//->withClaim('groupID', $result['group_id'])// Configures a new claim, called "groupID"
+		//->withClaim('email', $result['email'])// Configures a new claim, called "email"
+		//->withClaim('image', $result['image'])// Configures a new claim, called "image"
 		->withClaim('userID', $result['id'])// Configures a new claim, called "image"
 		->sign($signer, $this->config['organizrHash'])// creates a signature using "testing" as key
 		->getToken(); // Retrieves the generated token
@@ -3566,7 +3567,7 @@ class Organizr
 		file_put_contents($this->organizrLoginLog, $writeFailLog);
 	}
 	
-	public function writeLog($type = 'error', $message, $username = null)
+	public function writeLog($type = 'error', $message = null, $username = null)
 	{
 		$this->timeExecution = $this->timeExecution($this->timeExecution);
 		$message = $message . ' [Execution Time: ' . $this->formatSeconds($this->timeExecution) . ']';

+ 1 - 1
api/functions/normal-functions.php

@@ -352,7 +352,7 @@ trait NormalFunctions
 		}
 	}
 	
-	public function coookieSeconds($type, $name, $value = '', $ms, $http = true, $path = '/')
+	public function coookieSeconds($type, $name, $value = '', $ms = null, $http = true, $path = '/')
 	{
 		if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == "https") {
 			$Secure = true;

+ 6 - 6
api/functions/token-functions.php

@@ -25,15 +25,15 @@ trait TokenFunctions
 				$data->setAudience('Organizr');
 				if ($jwttoken->validate($data)) {
 					$result['valid'] = true;
-					$result['username'] = $jwttoken->getClaim('username');
-					$result['group'] = $jwttoken->getClaim('group');
-					$result['groupID'] = $jwttoken->getClaim('groupID');
+					//$result['username'] = $jwttoken->getClaim('username');
+					//$result['group'] = $jwttoken->getClaim('group');
+					//$result['groupID'] = $jwttoken->getClaim('groupID');
 					$result['userID'] = $jwttoken->getClaim('userID');
-					$result['email'] = $jwttoken->getClaim('email');
-					$result['image'] = $jwttoken->getClaim('image');
+					//$result['email'] = $jwttoken->getClaim('email');
+					//$result['image'] = $jwttoken->getClaim('image');
 					$result['tokenExpire'] = $jwttoken->getClaim('exp');
 					$result['tokenDate'] = $jwttoken->getClaim('iat');
-					$result['token'] = $jwttoken->getClaim('exp');
+					//$result['token'] = $jwttoken->getClaim('exp');
 				}
 			}
 			if ($result['valid'] == true) {