feat(auth): align verify-token with #118 invalid-link behavior

Treat missing token on GET /auth/verify-token as the same neutral invalid/expired/used response (404), matching ticket #118 expectations for /create-password flows.

Made-with: Cursor
This commit is contained in:
MARTIN Julien 2026-04-23 11:49:31 +02:00
parent e434fe2fbe
commit 29cbbb1d08

View File

@ -140,7 +140,9 @@ export class AuthService {
async verifyCreatePasswordToken(token: string) { async verifyCreatePasswordToken(token: string) {
const cleanedToken = token?.trim(); const cleanedToken = token?.trim();
if (!cleanedToken) { if (!cleanedToken) {
throw new BadRequestException('Token manquant'); // #118: côté front, un token absent doit être traité comme lien invalide/expiré.
// On renvoie donc la même réponse neutre 404 que pour les autres cas invalides.
throw new NotFoundException('Token invalide, expiré, ou déjà utilisé.');
} }
const user = await this.usersRepo.findOne({ const user = await this.usersRepo.findOne({