14 lines
1.4 KiB
PHP
14 lines
1.4 KiB
PHP
<?php
|
|
// Read-only check. Never prints credentials, attempts login, or resets accounts.
|
|
require __DIR__.'/../vendor/autoload.php';$app=require __DIR__.'/../bootstrap/app.php';$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
\App\Modules\Workshop\WorkshopBilling::guard();
|
|
$identity=\Illuminate\Support\Facades\DB::selectOne('SELECT current_database() AS db,current_user AS role');
|
|
if($identity->db!=='sgf_tempo_test'||$identity->role!=='sgf_test_runner')throw new RuntimeException('Wrong database; no accounts changed.');
|
|
$path='C:/laragon/data/sgf-tempo/secrets/workshop-billing-manual-entry.txt';
|
|
if(!is_file($path))throw new RuntimeException('Entry file missing; no credentials reset.');
|
|
$content=file_get_contents($path);
|
|
if(!str_contains($content,'http://127.0.0.1:8002')||!preg_match('/Temporary synthetic password for these two accounts: ([^\r\n]+)/',$content,$match))throw new RuntimeException('Unexpected entry format; no accounts changed.');
|
|
$checks=[];foreach(['gestor@example.test','consulta@example.test'] as $email){$u=\App\Models\User::where('email',$email)->first();$checks[]=['account'=>$email,'exists'=>(bool)$u,'entry_matches'=>$u&&\Illuminate\Support\Facades\Hash::check($match[1],$u->password)];}
|
|
unset($content,$match);
|
|
echo json_encode(['path'=>realpath($path),'database'=>$identity->db,'accounts'=>$checks,'credentials_changed'=>false],JSON_THROW_ON_ERROR).PHP_EOL;
|