[Bug]: Logged-in participants are never linked to their account
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 70/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- express, typescript
- Domaine
- api, authentication, backend
Piste de recherche
Start with authMiddleware in apps/http-server/src/middlewares/authmiddleware.ts to see how the token is verified, then look at the POST /join route in apps/http-server/src/routes/session.ts and joinQuizController in sessionController.ts, which reads req.userId. Add an optional variant that sets req.userId only when a valid token is present and otherwise calls next(). Done when a signed-in join stores its userId, and anonymous and expired-token joins still succeed.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happened?
joinQuizController in apps/http-server/src/controllers/sessionController.ts
stores the participant's user id:
const participant = await tx.participant.create({
data: {
username,
sessionId: session.id,
userId: req.userId || null
}
});
But the route has no authMiddleware:
apps/http-server/src/routes/session.ts:
router.post("/join", joinQuizController)
req.userId is only ever set by authMiddleware, so it is always
undefined here, and every participant row is written with userId: null —
including participants who are signed in.
Why it matters. planning.md promises that a registered user can see the
quizzes they participated in. getAllQuizesController cannot deliver that,
because nothing connects a Participant row to a User. The feature is
silently broken.
The tricky part. Joining must stay open to anonymous participants — that is
a core feature, no signup required to play. So this cannot simply have
authMiddleware bolted on, which would reject anonymous joins with a 401.
What is needed is optional authentication: attach req.userId when a valid
token is present, and continue without it otherwise.
Steps to reproduce
Suggested fix. Add an optionalAuth middleware next to the existing one in
apps/http-server/src/middlewares/authmiddleware.ts:
- No
Authorizationheader → callnext()with noreq.userId - Valid token → set
req.userId, callnext() - Malformed or expired token → also just
next()withoutreq.userId, so a
stale token in someone's browser does not block them from joining a quiz
Then apply it to POST /join.
Definition of done:
- A signed-in user who joins gets a
Participantrow with theiruserId - An anonymous user can still join with no token at all
- An expired token does not prevent joining
- Participation history works for registered users
Which part of Rexial?
http-server (Express REST API)
How are you running Rexial?
Docker Compose (docker-compose up)
Logs or error output
Environment
No response
Before submitting
- I searched existing issues and this has not been reported
- I am not including any secrets, API keys or passwords in this report
- Langage dominant
- TypeScript
- Étoiles
- 21
- Forks
- 7
- Merge moyen
- 4 h 13 min
- PR mergées (30 j)
- 20
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de TheCodeHeist-Coder/Rexial
-
documentation good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TheCodeHeist-Coder/Rexial#195 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
One PDF upload freezes the whole AI service, including its health checkPeut-être pris @Anshuu2004 l’a pris aujourd’hui. OuverteBackend first issue bug help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
TheCodeHeist-Coder/Rexial#193 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
The join endpoint returns an error shape the frontend cannot readPeut-être pris @Anshuu2004 l’a pris aujourd’hui. OuverteBackend first issue bug good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
TheCodeHeist-Coder/Rexial#192 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Registering without a password returns a 500 instead of telling you what is missingPeut-être pris @Anshuu2004 l’a pris aujourd’hui. OuverteBackend first issue bug good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
TheCodeHeist-Coder/Rexial#191 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
CI does not run the frontend testsPeut-être pris @nayan45633 l’a pris aujourd’hui. OuverteBackend first issue good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
TheCodeHeist-Coder/Rexial#188 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de TheCodeHeist-Coder/Rexial
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
farion1231/cc-switch#8829 ·
Les mainteneurs répondent en général sous 1 jour
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverOuvertedoc-audit enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100