Skip to content

Commit b7147df

Browse files
committed
Handle concurency in Csrf DoctrineTokenProvider
1 parent 29516dc commit b7147df

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,15 @@ public function updateExistingToken(PersistentTokenInterface $token, string $tok
192192
return;
193193
}
194194

195-
$this->deleteTokenBySeries($tmpSeries);
196-
$this->createNewToken(new PersistentToken($token->getClass(), $token->getUserIdentifier(), $tmpSeries, $token->getTokenValue(), $lastUsed));
195+
$this->conn->beginTransaction();
196+
try {
197+
$this->deleteTokenBySeries($tmpSeries);
198+
$this->createNewToken(new PersistentToken($token->getClass(), $token->getUserIdentifier(), $tmpSeries, $token->getTokenValue(), $lastUsed));
199+
200+
$this->conn->commit();
201+
} catch (\Exception $e) {
202+
$this->conn->rollBack();
203+
}
197204
}
198205

199206
/**

0 commit comments

Comments
 (0)