mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 17:16:51 +01:00 
			
		
		
		
	Add migration to clear password from auth:fail logs (#1533)
				
					
				
			This commit is contained in:
		
							parent
							
								
									4d03d6b948
								
							
						
					
					
						commit
						61098b11f2
					
				@ -0,0 +1,29 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use App\Models\ActivityLog;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
use Illuminate\Support\Facades\DB;
 | 
			
		||||
 | 
			
		||||
return new class extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     */
 | 
			
		||||
    public function up(): void
 | 
			
		||||
    {
 | 
			
		||||
        DB::transaction(function () {
 | 
			
		||||
            $logs = ActivityLog::where('event', 'auth:fail')->get();
 | 
			
		||||
            foreach ($logs as $log) {
 | 
			
		||||
                $log->update(['properties' => collect($log->properties)->except(['password'])->toArray()]);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     */
 | 
			
		||||
    public function down(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Not needed
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user