Skip to content

Instantly share code, notes, and snippets.

@joebordes
Created December 19, 2016 14:46
Show Gist options
  • Save joebordes/8fea7c827df3bcec65c717f5ed104a44 to your computer and use it in GitHub Desktop.
Save joebordes/8fea7c827df3bcec65c717f5ed104a44 to your computer and use it in GitHub Desktop.
Patch to permit defining the webservice expire time when authenticating
diff --git a/build/RESTexpiretimeparameter.sql b/build/RESTexpiretimeparameter.sql
new file mode 100644
index 0000000..dcf58de
--- /dev/null
+++ b/build/RESTexpiretimeparameter.sql
@@ -0,0 +1 @@
+INSERT INTO `vtiger_ws_operation_parameters`(`operationid`, `name`, `type`, `sequence`) VALUES ((SELECT `operationid` FROM `vtiger_ws_operation` WHERE `name`='getchallenge'),'exptime','string',2)
diff --git a/include/Webservices/AuthToken.php b/include/Webservices/AuthToken.php
index 7779348..f73c72e 100644
--- a/include/Webservices/AuthToken.php
+++ b/include/Webservices/AuthToken.php
@@ -8,7 +8,7 @@
* All Rights Reserved.
*************************************************************************************/
- function vtws_getchallenge($username){
+ function vtws_getchallenge($username,$exptime){
global $adb;
@@ -17,7 +17,8 @@
$authToken = uniqid();
$servertime = time();
- $expireTime = time()+(60*5);
+ if (empty($exptime)) $exptime = 5;
+ $expireTime = time()+(60*$exptime);
$sql = "delete from vtiger_ws_userauthtoken where userid=?";
$adb->pquery($sql,array($userid));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment