Comment out console() calls, CS fixes

This commit is contained in:
Aleksander Machniak 2016-01-28 17:12:23 +01:00
parent f1eada2be3
commit 669feb6b02
4 changed files with 40 additions and 43 deletions

View file

@ -25,36 +25,35 @@ namespace Kolab2FA\Driver;
abstract class Base abstract class Base
{ {
public $method = null; public $method;
public $id = null; public $id;
public $storage; public $storage;
protected $config = array(); protected $config = array();
protected $props = array(); protected $props = array();
protected $user_props = array(); protected $user_props = array();
protected $pending_changes = false; protected $pending_changes = false;
protected $temporary = false; protected $temporary = false;
protected $allowed_props = array('username');
protected $allowed_props = array('username');
public $user_settings = array( public $user_settings = array(
'active' => array( 'active' => array(
'type' => 'boolean', 'type' => 'boolean',
'editable' => false, 'editable' => false,
'hidden' => false, 'hidden' => false,
'default' => false, 'default' => false,
), ),
'label' => array( 'label' => array(
'type' => 'text', 'type' => 'text',
'editable' => true, 'editable' => true,
'label' => 'label', 'label' => 'label',
'generator' => 'default_label', 'generator' => 'default_label',
), ),
'created' => array( 'created' => array(
'type' => 'datetime', 'type' => 'datetime',
'editable' => false, 'editable' => false,
'hidden' => false, 'hidden' => false,
'label' => 'created', 'label' => 'created',
'generator' => 'time', 'generator' => 'time',
), ),
); );
@ -342,5 +341,4 @@ abstract class Base
{ {
return isset($this->props[$key]); return isset($this->props[$key]);
} }
}
}

View file

@ -44,15 +44,15 @@ class HOTP extends Base
$this->user_settings += array( $this->user_settings += array(
'secret' => array( 'secret' => array(
'type' => 'text', 'type' => 'text',
'private' => true, 'private' => true,
'label' => 'secret', 'label' => 'secret',
'generator' => 'generate_secret', 'generator' => 'generate_secret',
), ),
'counter' => array( 'counter' => array(
'type' => 'integer', 'type' => 'integer',
'editable' => false, 'editable' => false,
'hidden' => true, 'hidden' => true,
'generator' => 'random_counter', 'generator' => 'random_counter',
), ),
); );
@ -72,12 +72,12 @@ class HOTP extends Base
public function verify($code, $timestamp = null) public function verify($code, $timestamp = null)
{ {
// get my secret from the user storage // get my secret from the user storage
$secret = $this->get('secret'); $secret = $this->get('secret');
$counter = $this->get('counter'); $counter = $this->get('counter');
if (!strlen($secret)) { if (!strlen($secret)) {
// LOG: "no secret set for user $this->username" // LOG: "no secret set for user $this->username"
console("VERIFY HOTP: no secret set for user $this->username"); // rcube::console("VERIFY HOTP: no secret set for user $this->username");
return false; return false;
} }
@ -91,11 +91,11 @@ class HOTP extends Base
} }
catch (\Exception $e) { catch (\Exception $e) {
// LOG: exception // LOG: exception
console("VERIFY HOTP: $this->id, " . strval($e)); // rcube::console("VERIFY HOTP: $this->id, " . strval($e));
$pass = false; $pass = false;
} }
// console('VERIFY HOTP', $this->username, $secret, $counter, $code, $pass); // rcube::console('VERIFY HOTP', $this->username, $secret, $counter, $code, $pass);
return $pass; return $pass;
} }
@ -125,5 +125,4 @@ class HOTP extends Base
{ {
return mt_rand(1, 999); return mt_rand(1, 999);
} }
} }

View file

@ -44,9 +44,9 @@ class TOTP extends Base
$this->user_settings += array( $this->user_settings += array(
'secret' => array( 'secret' => array(
'type' => 'text', 'type' => 'text',
'private' => true, 'private' => true,
'label' => 'secret', 'label' => 'secret',
'generator' => 'generate_secret', 'generator' => 'generate_secret',
), ),
); );
@ -71,7 +71,7 @@ class TOTP extends Base
if (!strlen($secret)) { if (!strlen($secret)) {
// LOG: "no secret set for user $this->username" // LOG: "no secret set for user $this->username"
console("VERIFY TOTP: no secret set for user $this->username"); // rcube::console("VERIFY TOTP: no secret set for user $this->username");
return false; return false;
} }
@ -93,7 +93,7 @@ class TOTP extends Base
} }
} }
// console('VERIFY TOTP', $this->username, $secret, $code, $timestamp, $pass); // rcube::console('VERIFY TOTP', $this->username, $secret, $code, $timestamp, $pass);
return $pass; return $pass;
} }
@ -102,12 +102,12 @@ class TOTP extends Base
*/ */
public function get_provisioning_uri() public function get_provisioning_uri()
{ {
console('PROV', $this->secret); // rcube::console('PROV', $this->secret);
if (!$this->secret) { if (!$this->secret) {
// generate new secret and store it // generate new secret and store it
$this->set('secret', $this->get('secret', true)); $this->set('secret', $this->get('secret', true));
$this->set('created', $this->get('created', true)); $this->set('created', $this->get('created', true));
console('PROV2', $this->secret); // rcube::console('PROV2', $this->secret);
$this->commit(); $this->commit();
} }

View file

@ -44,9 +44,9 @@ class Yubikey extends Base
$this->user_settings += array( $this->user_settings += array(
'yubikeyid' => array( 'yubikeyid' => array(
'type' => 'text', 'type' => 'text',
'editable' => true, 'editable' => true,
'label' => 'secret', 'label' => 'secret',
), ),
); );
@ -66,7 +66,7 @@ class Yubikey extends Base
{ {
// get my secret from the user storage // get my secret from the user storage
$keyid = $this->get('yubikeyid'); $keyid = $this->get('yubikeyid');
$pass = false; $pass = false;
if (!strlen($keyid)) { if (!strlen($keyid)) {
// LOG: "no key registered for user $this->username" // LOG: "no key registered for user $this->username"
@ -77,14 +77,14 @@ class Yubikey extends Base
if (strpos($code, $keyid) === 0) { if (strpos($code, $keyid) === 0) {
try { try {
$response = $this->backend->check($code); $response = $this->backend->check($code);
$pass = $response->success() === true; $pass = $response->success() === true;
} }
catch (\Exception $e) { catch (\Exception $e) {
// TODO: log exception // TODO: log exception
} }
} }
console('VERIFY TOTP', $this->username, $keyid, $code, $pass); // rcube::console('VERIFY TOTP', $this->username, $keyid, $code, $pass);
return $pass; return $pass;
} }