mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 11:04:34 -04:00
Fixes for how we auth a client contact
This commit is contained in:
parent
63eae6000a
commit
f20db94b62
@ -55,13 +55,10 @@ class InvitationController extends Controller
|
|||||||
/* Return early if we have the correct client_hash embedded */
|
/* Return early if we have the correct client_hash embedded */
|
||||||
|
|
||||||
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) {
|
||||||
nlog("scenario 1");
|
|
||||||
auth()->guard('contact')->login($invitation->contact, true);
|
auth()->guard('contact')->login($invitation->contact, true);
|
||||||
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
||||||
nlog("scenario 2");
|
|
||||||
$this->middleware('auth:contact');
|
$this->middleware('auth:contact');
|
||||||
} else {
|
} else {
|
||||||
nlog("scenario 3");
|
|
||||||
auth()->guard('contact')->login($invitation->contact, true);
|
auth()->guard('contact')->login($invitation->contact, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +87,12 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
|||||||
'client_id',
|
'client_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/* Changing the username to id allows us to login() a contact that doesn't have an email address set*/
|
||||||
|
public function username()
|
||||||
|
{
|
||||||
|
return 'id';
|
||||||
|
}
|
||||||
|
|
||||||
public function getEntityType()
|
public function getEntityType()
|
||||||
{
|
{
|
||||||
return self::class;
|
return self::class;
|
||||||
|
@ -76,6 +76,7 @@ class ClientContactRepository extends BaseRepository
|
|||||||
$new_contact->client_id = $client->id;
|
$new_contact->client_id = $client->id;
|
||||||
$new_contact->contact_key = Str::random(40);
|
$new_contact->contact_key = Str::random(40);
|
||||||
$new_contact->is_primary = true;
|
$new_contact->is_primary = true;
|
||||||
|
$new_contact->confirmed = true;
|
||||||
$new_contact->save();
|
$new_contact->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user