fix: change emails to lowercase on init

This commit is contained in:
Andras Bacsai
2024-11-03 15:35:17 +01:00
parent 63cff9e399
commit f408d603cf

View File

@@ -10,6 +10,7 @@ use App\Models\Environment;
use App\Models\ScheduledDatabaseBackup;
use App\Models\Server;
use App\Models\StandalonePostgresql;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
@@ -41,6 +42,7 @@ class Init extends Command
$this->disable_metrics();
$this->replace_slash_in_environment_name();
$this->restore_coolify_db_backup();
$this->update_user_emails();
//
$this->update_traefik_labels();
if (! isCloud() || $this->option('force-cloud')) {
@@ -92,6 +94,11 @@ class Init extends Command
}
}
private function update_user_emails()
{
User::whereRaw('email ~ \'[A-Z]\'')->get()->each(fn (User $user) => $user->update(['email' => strtolower($user->email)]));
}
private function update_traefik_labels()
{
try {