style: liens sans soulignement, zone illustration en haut des tuiles

This commit is contained in:
Cedric Abonnel
2026-05-08 13:47:04 +02:00
parent 87172baf68
commit debbfe37f8
11 changed files with 67 additions and 98 deletions
+2 -8
View File
@@ -24,7 +24,7 @@ final class UserRepository
{
$email = strtolower(trim($email));
if ($email === '' || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
throw new InvalidArgumentException('Email OIDC invalide.');
throw new \InvalidArgumentException('Email OIDC invalide.');
}
// 1) Existe déjà ?
@@ -53,7 +53,7 @@ SQL;
':hash' => $randomHash,
]);
return (string)$st->fetchColumn();
} catch (PDOException $e) {
} catch (\PDOException $e) {
// Unique violation sur email (23505) → on relit lid (race condition)
if ($e->getCode() === '23505') {
$st = $this->pdo->prepare('SELECT id FROM users WHERE email = :email LIMIT 1');
@@ -67,12 +67,6 @@ SQL;
}
}
private function nullIfEmpty(?string $v): ?string
{
$v = trim((string)$v);
return $v === '' ? null : $v;
}
public function findByEmail(string $email): ?User
{
$sql = 'SELECT id, email, password_hash, is_active FROM users WHERE email = :email LIMIT 1';
+1 -1
View File
@@ -76,7 +76,7 @@ final class AuthService
// Mettre à jour le hash
$newHash = password_hash($newPassword, PASSWORD_ARGON2ID);
(new \App\Repository\UserRepository())->updatePassword($row['id'], $newHash);
(new \App\Repository\UserRepository(\App\Infrastructure\Database::get()))->updatePassword($row['id'], $newHash);
// (Optionnel) rotation session
\App\Infrastructure\Session::regenerate();
+2 -3
View File
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace App\Service;
use App\Infrastructure\Database;
use PDO;
use Throwable;
use DateTimeImmutable;
@@ -33,9 +32,9 @@ final class MailQueue
private PDO $pdo;
private MailService $mailService;
public function __construct(Database $db, MailService $mailService)
public function __construct(\PDO $pdo, MailService $mailService)
{
$this->pdo = $db->getConnection();
$this->pdo = $pdo;
$this->mailService = $mailService;
}
+14 -17
View File
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace App\Service;
use App\Infrastructure\Database;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception as MailException;
use PDO;
@@ -38,7 +37,7 @@ final class MailService
private array $smtpConfig;
/**
* @param Database $db Retourne un PDO connecté (PostgreSQL recommandé)
* @param \PDO $pdo PDO connecté (PostgreSQL recommandé)
* @param array<string,mixed> $smtpConfig [
* 'host' => 'smtp.example.tld',
* 'port' => 587,
@@ -52,9 +51,9 @@ final class MailService
* 'smtp_options' => [...] (optionnel, cf. PHPMailer::SMTPOptions)
* ]
*/
public function __construct(Database $db, array $smtpConfig)
public function __construct(\PDO $pdo, array $smtpConfig)
{
$this->pdo = $db->getConnection();
$this->pdo = $pdo;
$this->smtpConfig = $smtpConfig;
$this->mailer = new PHPMailer(true);
@@ -204,19 +203,17 @@ final class MailService
return false;
}
// 3) Garde-fou global / heure (optionnel)
if (self::MAX_GLOBAL_PER_HOUR > 0) {
$sql3 = <<<SQL
SELECT COUNT(*)::int
FROM journal_smtp
WHERE created_at >= (NOW() AT TIME ZONE 'UTC') - INTERVAL '1 hour'
AND status = 'sent'
SQL;
$stmt3 = $this->pdo->query($sql3);
$global1h = (int) $stmt3->fetchColumn();
if ($global1h >= self::MAX_GLOBAL_PER_HOUR) {
return false;
}
// 3) Garde-fou global / heure
$sql3 = <<<SQL
SELECT COUNT(*)::int
FROM journal_smtp
WHERE created_at >= (NOW() AT TIME ZONE 'UTC') - INTERVAL '1 hour'
AND status = 'sent'
SQL;
$stmt3 = $this->pdo->query($sql3);
$global1h = (int) $stmt3->fetchColumn();
if ($global1h >= self::MAX_GLOBAL_PER_HOUR) {
return false;
}
return true;
+1 -1
View File
@@ -23,6 +23,6 @@ function get_oidc_client(): OpenIDConnectClient
'varlog-client-secret'
);
$oidc->setRedirectURL('http://varlog.acegrp.lan/auth/callback.php');
$oidc->addScope('openid email profile');
$oidc->addScope(['openid', 'email', 'profile']);
return $oidc;
}