mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
Merge pull request #5964 from turbo124/v5-develop
Fixes for client portal links
This commit is contained in:
commit
b8365d94f8
@ -55,18 +55,21 @@ class InvitationController extends Controller
|
|||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
/* Return early if we have the correct client_hash embedded */
|
/* Return early if we have the correct client_hash embedded */
|
||||||
|
$client_contact = $invitation->contact;
|
||||||
|
|
||||||
|
if(empty($client_contact->email))
|
||||||
|
$client_contact->email = Str::random(15) . "@example.com"; $client_contact->save();
|
||||||
|
|
||||||
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
|
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
|
||||||
auth()->guard('contact')->loginUsingId($invitation->contact->id, true);
|
auth()->guard('contact')->login($client_contact, true);
|
||||||
|
|
||||||
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
||||||
|
|
||||||
//If no contact password is set - this will cause a 401 error - instead redirect to the client.login route
|
|
||||||
$this->middleware('auth:contact');
|
$this->middleware('auth:contact');
|
||||||
return redirect()->route('client.login');
|
return redirect()->route('client.login');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
auth()->guard('contact')->loginUsingId($invitation->contact->id, true);
|
nlog("else - default - login contact");
|
||||||
|
auth()->guard('contact')->login($client_contact, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class ContactKeyLogin
|
|||||||
if($client_contact = ClientContact::where('email', $contact_email)->where('company_id', $payload['company_id'])->first()){
|
if($client_contact = ClientContact::where('email', $contact_email)->where('company_id', $payload['company_id'])->first()){
|
||||||
|
|
||||||
if(empty($client_contact->email))
|
if(empty($client_contact->email))
|
||||||
$client_contact->email = Str::random(6) . "@example.com"; $client_contact->save();
|
$client_contact->email = Str::random(15) . "@example.com"; $client_contact->save();
|
||||||
|
|
||||||
auth()->guard('contact')->login($client_contact, true);
|
auth()->guard('contact')->login($client_contact, true);
|
||||||
|
|
||||||
|
@ -261,6 +261,9 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nlog($this->message);
|
||||||
|
nlog($this->pre_flight_checks_pass);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +281,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
//perform some magic here
|
//perform some magic here
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->pre_flight_checks_pass)
|
if($this->pre_flight_checks_pass === false)
|
||||||
{
|
{
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new CompanyImportFailure($this->company, $this->message);
|
$nmo->mailable = new CompanyImportFailure($this->company, $this->message);
|
||||||
|
@ -15,6 +15,7 @@ use App\Models\Account;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyUser;
|
use App\Models\CompanyUser;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user