Skip to content

Develop#36

Merged
ThomasCandille merged 4 commits into
mainfrom
develop
Apr 24, 2026
Merged

Develop#36
ThomasCandille merged 4 commits into
mainfrom
develop

Conversation

@ThomasCandille
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 24, 2026 10:21
@ThomasCandille ThomasCandille merged commit 4b6a559 into main Apr 24, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the authentication/onboarding flow to handle unknown/unscanned cards by enabling account creation without a scan (temporary card IDs) and enabling card association during login when a card is scanned.

Changes:

  • Add new UI states for “unknown card” and “link card via login”, plus a manual “S’inscrire” entry point.
  • Pass an optional scanned card ID during login to allow backend-side card association.
  • Backend: generate temporary card IDs on signup when no card is scanned, and enforce scanning a real card before completing login.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/components/Inscription/Inscription.tsx Adds placeholder card handling + displays backend error messages and an info banner when no card is scanned.
frontend/src/components/Inscription/Inscription.css Styles the new info banner.
frontend/src/components/Connexion/Connexion.tsx Adds optional scanned card association payload, dynamic title/info, and optional Back button.
frontend/src/components/Connexion/Connexion.css Updates layout/typography and adds styling for scanned-card info line.
frontend/src/App.tsx Introduces new app states (cardNotFound, linkLogin) and routes users through new flows.
frontend/src/App.css Refactors auth container layout and adds responsive styling and action layout.
backend/routes/users.py Adds scanned card linking on login; supports placeholder signup by generating temporary IDs; blocks login until a real card is associated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1 to 5
.connexion_container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.connexion_container n’a plus de padding en desktop (il n’est défini que dans le media query mobile). Comme Connexion est rendu sans wrapper dans l’état linkLogin, le formulaire risque d’être collé aux bords du conteneur. Réintroduire un padding par défaut sur .connexion_container ou envelopper Connexion dans un conteneur qui gère l’espacement dans tous les cas.

Copilot uses AI. Check for mistakes.
Comment thread frontend/src/App.tsx
Comment on lines +12 to 13
const NO_CARD_PLACEHOLDER = '000000';

Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO_CARD_PLACEHOLDER est défini ici, dans Inscription.tsx et côté backend (backend/routes/users.py). Comme c’est une valeur de protocole frontend/backend, cette duplication peut dériver silencieusement. Centraliser la constante (ex: fichier constants, config, ou valeur renvoyée par l’API) pour garantir la cohérence.

Suggested change
const NO_CARD_PLACEHOLDER = '000000';

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +100
<p className="inscription_info">
Aucun scan de carte detecte. Un identifiant provisoire sera utilise jusqu&apos;a l&apos;association d&apos;une carte.
</p>
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Texte UI ajouté avec plusieurs accents manquants (ex: « detecte », « utilise », « jusqu'a »). Comme d’autres écrans utilisent les accents, corriger la phrase pour une meilleure qualité de contenu et cohérence.

Copilot uses AI. Check for mistakes.
Comment thread backend/routes/users.py
Comment on lines +107 to +111
existing_email = (
supabase
.table("CreaLab_visitors")
.select("email")
.eq("email", data.email)
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La vérification existing_email renvoie un message explicite quand un email existe déjà. Ça facilite l’énumération d’emails (et donc la collecte d’infos) via l’endpoint d’inscription. Envisager de renvoyer un message plus générique (ou de toujours répondre 200/202) et/ou d’ajouter des protections (rate limiting, CAPTCHA) selon le contexte de déploiement.

Copilot uses AI. Check for mistakes.
Comment thread backend/routes/users.py

normalized_card_id = data.card_id.strip()
if normalized_card_id == NO_CARD_PLACEHOLDER:
normalized_card_id = f"{TEMP_CARD_PREFIX}{uuid4().hex[:12]}"
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dans le cas NO_CARD_PLACEHOLDER, vous générez un normalized_card_id temporaire mais ne réinitialisez pas latest_card. Si une carte a été scannée juste avant, le contexte (id/ts) reste potentiellement valide et pourrait être réutilisé par inadvertance par d’autres endpoints protégés par validate_card_context. Pensez à invalider/vider latest_card aussi dans cette branche.

Suggested change
normalized_card_id = f"{TEMP_CARD_PREFIX}{uuid4().hex[:12]}"
normalized_card_id = f"{TEMP_CARD_PREFIX}{uuid4().hex[:12]}"
latest_card["id"] = None
latest_card["ts"] = None

Copilot uses AI. Check for mistakes.
Comment thread backend/routes/users.py
Comment on lines +67 to +69
if scanned_card_id:
validate_card_context(latest_card, scanned_card_id)

Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L’association de carte via scanned_card_id repose sur validate_card_context(latest_card, scanned_card_id)latest_card est un état global partagé. En environnement multi-clients, un scan récent d’un autre utilisateur peut permettre une association erronée (condition de course). Pour fiabiliser, stocker le contexte de scan par client/session (token côté frontend, binding à socket id, ou autre mécanisme) plutôt qu’un unique latest_card global.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants