mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01: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 */
|
||||
|
||||
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
|
||||
nlog("scenario 1");
|
||||
auth()->guard('contact')->login($invitation->contact, true);
|
||||
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
|
||||
nlog("scenario 2");
|
||||
$this->middleware('auth:contact');
|
||||
} else {
|
||||
nlog("scenario 3");
|
||||
auth()->guard('contact')->login($invitation->contact, true);
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,12 @@ class ClientContact extends Authenticatable implements HasLocalePreference
|
||||
'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()
|
||||
{
|
||||
return self::class;
|
||||
|
@ -76,6 +76,7 @@ class ClientContactRepository extends BaseRepository
|
||||
$new_contact->client_id = $client->id;
|
||||
$new_contact->contact_key = Str::random(40);
|
||||
$new_contact->is_primary = true;
|
||||
$new_contact->confirmed = true;
|
||||
$new_contact->save();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user