fixing capatcha verification issue

Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/7aca00c8
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/7aca00c8
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/7aca00c8

Branch: refs/heads/master
Commit: 7aca00c88ef1585c795971f0290eeef1c72325bd
Parents: d2f6dd5
Author: scnakandala <[email protected]>
Authored: Tue Mar 1 14:18:16 2016 -0500
Committer: scnakandala <[email protected]>
Committed: Tue Mar 1 14:18:16 2016 -0500

----------------------------------------------------------------------
 app/controllers/AccountController.php | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7aca00c8/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php 
b/app/controllers/AccountController.php
index 2b16190..7812f7a 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -325,7 +325,7 @@ class AccountController extends BaseController
                 }else{
                     $capatcha = WSIS::getCapatcha()->return;
                     //hack to work with wso2 IS 5.0.0
-                    if (file_exists($capatcha->imagePath)){
+                    if 
(is_array(getimagesize(Config::get('pga_config.wsis')['service-url'] . 
$capatcha->imagePath))){
                         return View::make("account/verify-human", 
array("username"=>$username,"code"=>$confirmation,
                             "imagePath"=>$capatcha->imagePath, 
"secretKey"=>$capatcha->secretKey,
                             "imageUrl"=> 
Config::get("pga_config.wsis")["service-url"] . $capatcha->imagePath));
@@ -343,6 +343,24 @@ class AccountController extends BaseController
         }
     }
 
+    private function checkRemoteFile($url)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL,$url);
+        // don't download content
+        curl_setopt($ch, CURLOPT_NOBODY, 1);
+        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        if(curl_exec($ch)!==FALSE)
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
     private function sendAccountCreationNotification2Admin($username){
 
         $mail = new PHPMailer;

Reply via email to