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

View file

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

View file

@ -44,9 +44,9 @@ class TOTP extends Base
$this->user_settings += array(
'secret' => array(
'type' => 'text',
'private' => true,
'label' => 'secret',
'type' => 'text',
'private' => true,
'label' => 'secret',
'generator' => 'generate_secret',
),
);
@ -71,7 +71,7 @@ class TOTP extends Base
if (!strlen($secret)) {
// 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;
}
@ -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;
}
@ -102,12 +102,12 @@ class TOTP extends Base
*/
public function get_provisioning_uri()
{
console('PROV', $this->secret);
// rcube::console('PROV', $this->secret);
if (!$this->secret) {
// generate new secret and store it
$this->set('secret', $this->get('secret', true));
$this->set('created', $this->get('created', true));
console('PROV2', $this->secret);
// rcube::console('PROV2', $this->secret);
$this->commit();
}

View file

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