...

// changes ekaay 1 of 4
      
                if ($this->is_ekaay_token_valid($email,$this->sSYSTEM->_POST["password"]))
                {

                   $sql = "SELECT id, customergroup FROM s_user WHERE email=? AND active=1 AND (lockeduntil < now() OR lockeduntil IS NULL) ".$addScopeSql;
                   $getUser = $this->sSYSTEM->sDB_CONNECTION->GetRow($sql,array($email));

                   if(count($getUser))
                   {
                       Enlight()->Events()->notify('Shopware_Modules_Admin_Login_Successful', array('subject'=>$this,'email'=>$email,'password'=>$this->sSYSTEM->_POST["password"],'user'=>$getUser));
                       $this->sSYSTEM->_SESSION["sUserMail"] = $email;
                       $this->sSYSTEM->_SESSION["sUserPassword"] = $this->sSYSTEM->_POST["password"];
                       $this->sSYSTEM->_SESSION["sUserId"] = $getUser["id"];

                       $this->sCheckUser();

                   } else {
                       Enlight()->Events()->notify('Shopware_Modules_Admin_Login_Failure', array('subject'=>$this,'email'=>$email,'password'=>$password,'error'=>$sErrorMessages));
                       unset($this->sSYSTEM->_SESSION["sUserMail"]);
                       unset($this->sSYSTEM->_SESSION["sUserPassword"]);
                       unset($this->sSYSTEM->_SESSION["sUserId"]);
                   }

                } else {

// end changes ekaay 1 of 4


...


// changes ekaay 2 of 4
      
                } 

// end changes ekaay 2 of 4


...


// changes ekaay 3 of 4

function is_ekaay_token_valid($user,$token) {
    $handle = curl_init("http://ekaay.com/integration/shopware/install_4.0.7/ekaay/ekaaycore/server/wwwsrv/_srv/checkToken.php?user=" 
                         . urlencode($user) . "&token=" . $token);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1);
    $res = trim(curl_exec($handle)); curl_close($handle);
    if ($res =="ok") return true; 
    else return false;
}

// end changes ekaay 3 of 4


...


// changes ekaay 4 of 4


        if(count($getUser)) {} else {

        if ($this->is_ekaay_token_valid($this->sSYSTEM->_SESSION["sUserMail"],$this->sSYSTEM->_SESSION["sUserPassword"])) {
     
        $sql = "
            SELECT * FROM s_user
            WHERE email=? AND id=? AND UNIX_TIMESTAMP(lastlogin)>=(UNIX_TIMESTAMP(now())-?)
        ";

        $timeOut = $this->sSYSTEM->sCONFIG['sUSERTIMEOUT'];
        $timeOut = !empty($timeOut) ? $timeOut : 7200;
        $getUser = $this->sSYSTEM->sDB_CONNECTION->GetRow($sql,array(
            $this->sSYSTEM->_SESSION["sUserMail"],
            $this->sSYSTEM->_SESSION["sUserId"],
            $timeOut
        ));

        }
        }

// end changes ekaay 4 of 4


...