1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #5964 from turbo124/v5-develop

Fixes for client portal links
This commit is contained in:
David Bomba 2021-06-08 21:45:37 +10:00 committed by GitHub
commit b8365d94f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 11 deletions

View File

@ -55,18 +55,21 @@ class InvitationController extends Controller
->firstOrFail();
/* 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) {
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) {
//If no contact password is set - this will cause a 401 error - instead redirect to the client.login route
$this->middleware('auth:contact');
return redirect()->route('client.login');
} else {
auth()->guard('contact')->loginUsingId($invitation->contact->id, true);
nlog("else - default - login contact");
auth()->guard('contact')->login($client_contact, true);
}

View File

@ -46,7 +46,7 @@ class ContactKeyLogin
if($client_contact = ClientContact::where('email', $contact_email)->where('company_id', $payload['company_id'])->first()){
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);

View File

@ -261,6 +261,9 @@ class CompanyImport implements ShouldQueue
}
nlog($this->message);
nlog($this->pre_flight_checks_pass);
return $this;
}
@ -278,7 +281,7 @@ class CompanyImport implements ShouldQueue
//perform some magic here
}
if(!$this->pre_flight_checks_pass)
if($this->pre_flight_checks_pass === false)
{
$nmo = new NinjaMailerObject;
$nmo->mailable = new CompanyImportFailure($this->company, $this->message);

View File

@ -15,6 +15,7 @@ use App\Models\Account;
use App\Models\Company;
use App\Models\CompanyUser;
use App\Models\User;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
/**