@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
require __DIR__.'/boot-QA.php';
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
$path=dirname($source).'/fixture-private.json';$fixture=json_decode(file_get_contents($path),true);
|
||||
if(isset($fixture['actors']['installer']))throw new RuntimeException('Installer already prepared');
|
||||
$pair=DB::table('portal_superuser_pair')->where('id',1)->first();$id=(int)$pair->first_user_id;
|
||||
if($id!==27)throw new RuntimeException('Unexpected existing QA pair');
|
||||
$password=bin2hex(random_bytes(20));$alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';$secret='';for($i=0;$i<32;$i++)$secret.=$alphabet[random_int(0,31)];
|
||||
$email='qa-economic-'.$id.'@example.invalid';
|
||||
DB::table('users')->where('id',$id)->update(['email'=>$email,'email_verified_at'=>now(),'password'=>Hash::make($password),'two_factor_secret'=>Crypt::encrypt($secret),'two_factor_recovery_codes'=>Crypt::encrypt('[]'),'two_factor_confirmed_at'=>now(),'remember_token'=>null]);
|
||||
$fixture['actors']['installer']=['id'=>$id,'email'=>$email,'password'=>$password,'secret'=>$secret];
|
||||
file_put_contents($path,json_encode($fixture,JSON_THROW_ON_ERROR));
|
||||
file_put_contents($source.'/.env',"\nPORTAL_MANAGER_EMAILS=qa-economic-2@example.invalid,qa-economic-31@example.invalid,qa-economic-27@example.invalid\n",FILE_APPEND);
|
||||
echo json_encode(['QA_installer_existing_pair'=>$id,'grants_changed'=>0]);
|
||||
Reference in New Issue
Block a user