Merged in fix/SW-2358-find-my-booking-logged-in-user (pull request #2572)

fix(SW-2358): Enabled anonymous booking view for logged in user

* fix(SW-2358): Enabled anonymous booking view for logged in user

* fix(SW-2358): Fixed test case for anonymous booking


Approved-by: Matilda Landström
This commit is contained in:
Hrishikesh Vaipurkar
2025-07-30 08:29:15 +00:00
parent 216cb706ad
commit c516860466
2 changed files with 13 additions and 16 deletions

View File

@@ -42,21 +42,19 @@ function accessBooking(
user.email.toLowerCase() === guest.email?.toLowerCase()
) {
return ACCESS_GRANTED
} else {
return ERROR_FORBIDDEN
}
}
const values =
cookie && (JSON.parse(cookie) as Partial<AdditionalInfoCookieValue>)
if (
values &&
values.firstName?.toLowerCase() === guest.firstName?.toLowerCase() &&
values.email?.toLowerCase() === guest.email?.toLowerCase()
) {
return ACCESS_GRANTED
} else {
const values =
cookie && (JSON.parse(cookie) as Partial<AdditionalInfoCookieValue>)
if (
values &&
values.firstName?.toLowerCase() === guest.firstName?.toLowerCase() &&
values.email?.toLowerCase() === guest.email?.toLowerCase()
) {
return ACCESS_GRANTED
} else {
return ERROR_BAD_REQUEST
}
return ERROR_BAD_REQUEST
}
}