Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Update class.OtpAuthFrontend.php
Browse files Browse the repository at this point in the history
  • Loading branch information
c12simple committed Sep 11, 2014
1 parent b27ed18 commit 22ba3d2
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions core/src/plugins/authfront.otp/class.OtpAuthFrontend.php
Expand Up @@ -25,10 +25,10 @@ class OtpAuthFrontend extends AbstractAuthFrontend
/*
private $enable_Create_User;
private $modifyLoginScreen;
private $userFilePath;
private $userFilePath;*/

private $yubicoSecretKey;
private $yubicoClientId;
*/
private $google;
private $googleLast;
private $yubikey1;
Expand Down Expand Up @@ -59,7 +59,7 @@ function tryToLogUser(&$httpVars, $isLast = false)
if(strlen($httpVars["password"]) > 6){
$codeOTP = substr($httpVars["password"], -6);
}else{
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
//return $this->FalseAndClearPassword($httpVars);
}

Expand All @@ -75,7 +75,7 @@ function tryToLogUser(&$httpVars, $isLast = false)
return false;
}
else{
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
}
}elseif
// YubiKey1 or YubiKey2 set
Expand All @@ -85,7 +85,7 @@ function tryToLogUser(&$httpVars, $isLast = false)
if ($this->checkYubiPass($httpVars["password"], $this->yubikey1, $this->yubikey2)){
return false;
}else{
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
}
}elseif
// Both Yubikey and Google Authenticator set
Expand All @@ -96,19 +96,19 @@ function tryToLogUser(&$httpVars, $isLast = false)
return false;
}
else{
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
}
}
else{
if ($this->checkYubiPass($httpVars["password"], $this->yubikey1, $this->yubikey2)){
return false;
}
else{
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
}
}
}
throw new Excetion($exceptionMsg);
throw new AJXP_Excetion($exceptionMsg);
//return $this->FalseAndClearPassword($httpVars);
}

Expand All @@ -132,6 +132,12 @@ private function loadConfig($userid)
$this->yubikey2 = !empty($roleData["PARAMETERS"]["AJXP_REPO_SCOPE_ALL"]["authfront.otp"]["yubikey2"]) ?
$roleData["PARAMETERS"]["AJXP_REPO_SCOPE_ALL"]['authfront.otp']["yubikey2"] : '';

if (!empty($this->pluginConf["YUBICO_CLIENT_ID"])) {
$this->yubicoClientId = trim($this->pluginConf["YUBICO_CLIENT_ID"]);
}
if (!empty($this->pluginConf["YUBICO_SECRET_KEY"])) {
$this->$yubicoSecretKey = trim($this->pluginConf["YUBICO_SECRET_KEY"]);
}
}

// Google Authenticator
Expand Down Expand Up @@ -258,7 +264,7 @@ public function checkYubiPass($pass, $yubikey1, $yubikey2)
$yotp = substr($pass, -44);
$pass = substr($pass, 0, strlen($pass) - 44);

$yubi = new Auth_Yubico($this->yubico_client_id, $this->yubico_secret_key);
$yubi = new Auth_Yubico($this->yubicoClientId, $this->yubicoSecretKey);
$auth = $yubi->verify($yotp);

return (!PEAR::isError($auth));
Expand All @@ -268,4 +274,4 @@ private function FalseAndClearPassword(&$httpVars){
$httpVars["password"] = "";
return false;
}
}
}

0 comments on commit 22ba3d2

Please sign in to comment.