return false;
}
-
- // local auth -
+ // local auth -
$default_admin = false;
if (!empty($ff->Pman['local_autoauth']) &&
($ff->Pman['local_autoauth'] === true) &&
)
)
) {
+
$group = DB_DataObject::factory('core_group');
$group->get('name', 'Administrators');
return false;
}
- $au = $this->getAuthUser();
+ if(empty($this->oath_key)) {
+ return true;
+ }
- $cmd = "{$oathtool} --totp --base32 {$au->oath_key}";
+ $cmd = "{$oathtool} --totp --base32 " . escapeshellarg($this->oath_key);
$password = exec($cmd);
// missing id for core_person mgmt
if(!empty($q['_to_qr_code'])){
- $au = $this->getAuthUser();
+ if($q['id'] == 'is_auth') {
+ $person = $this->getAuthUser();
+ } else {
+ $person = DB_DataObject::factory('Core_person');
+ $person->get($q['id']);
+ }
- $o = clone($au);
+ $o = clone($person);
- $au->generateOathKey();
+ $person->generateOathKey();
- $au->update($o);
+ $person->update($o);
- $qrcode = $au->generateQRCode();
+ $qrcode = $person->generateQRCode();
if(empty($qrcode)){
$roo->jerr('Fail to generate QR Code');
if(!empty($q['two_factor_auth_code'])) {
- if($this->checkTwoFactorAuthentication($q['two_factor_auth_code'])) {
+ $person = $this;
+
+ if(isset($q['id'])) {
+ $person = DB_DataObject::factory('core_person');
+ $person->get($q['id']);
+ }
+
+ if($person->checkTwoFactorAuthentication($q['two_factor_auth_code'])) {
$roo->jok('DONE');
}
if(!empty($q['oath_key_disable'])) {
- $au = $this->getAuthUser();
+ $person = $this->getAuthUser();
+
+ if(!empty($q['id'])) {
+ $person = DB_DataObject::factory('core_person');
+ $person->get($q['id']);
+ }
- if(empty($au)) {
+ if(empty($person)) {
$roo->jerr('Please login to the system');
}
- $o = clone($au);
+ $o = clone($person);
- $au->oath_key = '';
+ $person->oath_key = '';
- $au->update($o);
+ $person->update($o);
$roo->jok('DONE');
}