diff --git a/app/Console/Commands/CheckDb.php b/app/Console/Commands/CheckDb.php index 198a391f6e03..504a1c2b315b 100644 --- a/app/Console/Commands/CheckDb.php +++ b/app/Console/Commands/CheckDb.php @@ -126,9 +126,9 @@ class CheckDb extends Command public function handle() { - foreach($this->entities as $entity) { + $this->LogMessage("Checking - V5_DB1"); - $this->LogMessage("V5_DB1"); + foreach($this->entities as $entity) { $count_db_1 = $entity::on('db-ninja-01')->count(); $count_db_2 = $entity::on('db-ninja-02a')->count(); @@ -140,11 +140,10 @@ class CheckDb extends Command } + $this->LogMessage("Checking - V5_DB2"); foreach($this->entities as $entity) { - $this->LogMessage("V5_DB2"); - $count_db_1 = $entity::on('db-ninja-02')->count(); $count_db_2 = $entity::on('db-ninja-01a')->count(); diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index f910b96b0664..5ceae6cf5950 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -71,7 +71,7 @@ class PasswordProtection nlog($query); //If OAuth and user also has a password set - check both - if ($existing_user = MultiDB::hasUser($query) && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { + if ($existing_user = MultiDB::hasUser($query) && auth()->user()->company()->oauth_password_required && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { nlog("existing user with password"); @@ -79,10 +79,10 @@ class PasswordProtection return $next($request); } - elseif($existing_user = MultiDB::hasUser($query) && !auth()->user()->has_password){ + elseif($existing_user = MultiDB::hasUser($query) && !auth()->user()->company()->oauth_password_required){ nlog("existing user without password"); - + Cache::put(auth()->user()->hashed_id.'_'.auth()->user()->account_id.'_logged_in', Str::random(64), $timeout); return $next($request); }