Files
carmine.savino d6a9978167 feat: Implement client authentication and pre-fill functionality
- Added AuthController for client login and token management.
- Introduced AuthGate for handling authentication state and login UI.
- Updated API to support fetching client data for pre-filling forms.
- Modified App.vue to pre-fill client information if logged in.
- Enhanced client model to include username and password fields.
- Created migration for adding username and password to clients table.
- Added utility for generating secure usernames and passwords.
- Updated frontend to handle client tokens for pre-filling checkout forms.
- Removed old CSS file and updated HTML references to new assets.
- Added StatsOverview widget for displaying client and quote statistics.
- Improved error handling and user feedback in the login process.
2026-08-24 17:24:46 +02:00

26 lines
635 B
PHP

<?php
namespace App\Support;
use App\Models\Cliente;
use Illuminate\Support\Str;
class ClienteCredenziali
{
/** Genera un nome utente tipo "user2130" (numero casuale, minimo 4 cifre) non ancora in uso. */
public static function generaUsername(): string
{
do {
$username = 'user'.random_int(1000, 999999);
} while (Cliente::where('username', $username)->exists());
return $username;
}
/** Genera una password casuale sicura (lettere maiuscole/minuscole, numeri, simboli). */
public static function generaPassword(): string
{
return Str::password(14);
}
}