Changeset View
Changeset View
Standalone View
Standalone View
src/app/Auth/SecondFactor.php
<?php | <?php | ||||
namespace App\Auth; | namespace App\Auth; | ||||
use App\Sku; | use App\Sku; | ||||
use App\User; | use App\User; | ||||
use Illuminate\Support\Facades\Auth; | use Illuminate\Support\Facades\Auth; | ||||
use Illuminate\Support\Facades\DB; | |||||
use Kolab2FA\Storage\Base; | use Kolab2FA\Storage\Base; | ||||
/** | /** | ||||
* A class to maintain 2-factor authentication | * A class to maintain 2-factor authentication | ||||
*/ | */ | ||||
class SecondFactor extends Base | class SecondFactor extends Base | ||||
{ | { | ||||
protected $user; | protected $user; | ||||
▲ Show 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | protected function savePrefs($prefs) | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Init connection to the Roundcube database | * Init connection to the Roundcube database | ||||
*/ | */ | ||||
public static function dbh() | public static function dbh() | ||||
{ | { | ||||
$dsn = \config('2fa.dsn'); | return \App\Backends\Roundcube::dbh(); | ||||
if (empty($dsn)) { | |||||
\Log::warning("2-FACTOR database not configured"); | |||||
return DB::connection(\config('database.default')); | |||||
} | |||||
\Config::set('database.connections.2fa', ['url' => $dsn]); | |||||
return DB::connection('2fa'); | |||||
} | } | ||||
} | } |