Changeset View
Changeset View
Standalone View
Standalone View
src/app/Auth/SecondFactor.php
Show First 20 Lines • Show All 309 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'); | $connection = '2fa'; | ||||
if (empty($dsn)) { | if (!\env('MFA_DSN')) { | ||||
\Log::warning("2-FACTOR database not configured"); | \Log::warning("2-FACTOR database not configured. Using the default connection."); | ||||
return DB::connection(\config('database.default')); | $connection = \config('database.default'); | ||||
} | } | ||||
\Config::set('database.connections.2fa', ['url' => $dsn]); | return DB::connection($connection); | ||||
return DB::connection('2fa'); | |||||
} | } | ||||
} | } |