Add error for already used token

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-05 17:54:51 +02:00
parent caeac0ed1c
commit d43526bff4
7 changed files with 82 additions and 1 deletions

View File

@@ -680,7 +680,7 @@ func (s AuthService) OpenSessionWithMagicLink(ctx context.Context, tokenString s
if err := token.LoadByHashedValueForUpdate(ctx, tx, hashedValue); err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return NewInvalidTokenError()
return NewTokenAlreadyUsedError()
}
return fmt.Errorf("cannot load token by hashed value: %w", err)