Develop#36
Conversation
…ription processes
Feat/inscription nocard
There was a problem hiding this comment.
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.
| .connexion_container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; |
There was a problem hiding this comment.
.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.
| const NO_CARD_PLACEHOLDER = '000000'; | ||
|
|
There was a problem hiding this comment.
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.
| const NO_CARD_PLACEHOLDER = '000000'; |
| <p className="inscription_info"> | ||
| Aucun scan de carte detecte. Un identifiant provisoire sera utilise jusqu'a l'association d'une carte. | ||
| </p> |
There was a problem hiding this comment.
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.
| existing_email = ( | ||
| supabase | ||
| .table("CreaLab_visitors") | ||
| .select("email") | ||
| .eq("email", data.email) |
There was a problem hiding this comment.
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.
|
|
||
| normalized_card_id = data.card_id.strip() | ||
| if normalized_card_id == NO_CARD_PLACEHOLDER: | ||
| normalized_card_id = f"{TEMP_CARD_PREFIX}{uuid4().hex[:12]}" |
There was a problem hiding this comment.
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.
| 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 |
| if scanned_card_id: | ||
| validate_card_context(latest_card, scanned_card_id) | ||
|
|
There was a problem hiding this comment.
L’association de carte via scanned_card_id repose sur validate_card_context(latest_card, scanned_card_id) où 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.
No description provided.