Support extra URL parameters for iframe feature

This commit is contained in:
Hillel Coren 2017-02-20 12:57:21 +02:00
parent fb1a42c838
commit 7a152e8877
3 changed files with 8 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class ClientPortalController extends BaseController
$account->loadLocalizationSettings($client); $account->loadLocalizationSettings($client);
if (! Input::has('phantomjs') && ! session('silent') && ! Session::has($invitationKey) if (! Input::has('phantomjs') && ! session('silent') && ! Session::has($invitation->invitation_key)
&& (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) { && (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
if ($invoice->isType(INVOICE_TYPE_QUOTE)) { if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
event(new QuoteInvitationWasViewed($invoice, $invitation)); event(new QuoteInvitationWasViewed($invoice, $invitation));
@ -78,7 +78,7 @@ class ClientPortalController extends BaseController
} }
} }
Session::put($invitationKey, true); // track this invitation has been seen Session::put($invitation->invitation_key, true); // track this invitation has been seen
Session::put('contact_key', $invitation->contact->contact_key); // track current contact Session::put('contact_key', $invitation->contact->contact_key); // track current contact
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date); $invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);

View File

@ -104,6 +104,9 @@ class Authenticate
*/ */
protected function getInvitation($key) protected function getInvitation($key)
{ {
// check for extra params at end of value (from website feature)
list($key) = explode('&', $key);
$invitation = Invitation::withTrashed()->where('invitation_key', '=', $key)->first(); $invitation = Invitation::withTrashed()->where('invitation_key', '=', $key)->first();
if ($invitation && ! $invitation->is_deleted) { if ($invitation && ! $invitation->is_deleted) {
return $invitation; return $invitation;

View File

@ -827,6 +827,9 @@ class InvoiceRepository extends BaseRepository
*/ */
public function findInvoiceByInvitation($invitationKey) public function findInvoiceByInvitation($invitationKey)
{ {
// check for extra params at end of value (from website feature)
list($invitationKey) = explode('&', $invitationKey);
/** @var \App\Models\Invitation $invitation */ /** @var \App\Models\Invitation $invitation */
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->first(); $invitation = Invitation::where('invitation_key', '=', $invitationKey)->first();