feat: local password hashes
This commit is contained in:
1 parent
08f6633507
commit
fe562e5e73
15 files changed
+541
-253
No files matched your search
@@ -11,7 +11,6 @@ use App\BusProNet\Model\Notification;
|
||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||
use App\Entity\User;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Security\Crypt;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
@@ -37,7 +36,6 @@ class BookingEditDataLoader
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly BookingEditDraftManager $draftService,
|
||||
private readonly AgencyLoader $agencyLoader,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly TagAwareCacheInterface $bpnCache,
|
||||
) {
|
||||
}
|
||||
@@ -179,14 +177,13 @@ class BookingEditDataLoader
|
||||
$cacheKey = $this->getBookingCacheKey($bookingId, $user);
|
||||
$userTag = self::CACHE_TAG_USER_PREFIX.$user->getId();
|
||||
$email = $user->getEmail();
|
||||
$password = $this->crypt->decrypt($user->getPassword());
|
||||
|
||||
try {
|
||||
return $this->bpnCache->get($cacheKey, function (ItemInterface $item) use ($email, $password, $bookingId, $userTag) {
|
||||
return $this->bpnCache->get($cacheKey, function (ItemInterface $item) use ($email, $bookingId, $userTag, $user) {
|
||||
$item->expiresAfter(300);
|
||||
$item->tag([$userTag]);
|
||||
|
||||
return $this->apiClient->getBooking($email, $password, $bookingId);
|
||||
return $this->apiClient->getBooking($email, $bookingId, $user->getAddressId(), $user->getPersonId());
|
||||
});
|
||||
} catch (InvalidArgumentException) {
|
||||
return null;
|
||||
|
||||
@@ -10,7 +10,6 @@ use App\BusProNet\Model\Notification;
|
||||
use App\Entity\User;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Security\Crypt;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
@@ -27,7 +26,6 @@ class ParticipantDataPrefiller
|
||||
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
@@ -48,12 +46,10 @@ class ParticipantDataPrefiller
|
||||
public function prefillApplicantFromUser(User $user, ParticipantDto $applicant): ParticipantDto
|
||||
{
|
||||
try {
|
||||
// Decrypt user password for API authentication
|
||||
$password = $this->crypt->decrypt($user->getPassword());
|
||||
$email = $user->getEmail();
|
||||
|
||||
// Fetch personal data from API
|
||||
$result = $this->apiClient->getPersonalData($email, $password);
|
||||
$result = $this->apiClient->getPersonalData($email, $user->getAddressId(), $user->getPersonId());
|
||||
|
||||
// Handle API error response
|
||||
if ($result instanceof Notification) {
|
||||
@@ -90,7 +86,7 @@ class ParticipantDataPrefiller
|
||||
|
||||
return $applicant;
|
||||
} catch (\Exception $e) {
|
||||
// Catch any unexpected exceptions (decryption failure, API errors, etc.)
|
||||
// Catch any unexpected exceptions (API errors, etc.)
|
||||
$this->logger->error('Exception during applicant prepopulation', [
|
||||
'error' => $e->getMessage(),
|
||||
'email' => $user->getEmail(),
|
||||
|
||||
Reference in new issue
Block a user