1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Refactor invitation links

This commit is contained in:
David Bomba 2021-11-06 11:46:12 +11:00
parent 52a49f1b18
commit e2a6cd65cc
11 changed files with 12 additions and 12 deletions

View File

@ -127,7 +127,7 @@ class ImportMigrations extends Command
$user = User::factory()->create([
'account_id' => $account->id,
'email' => Str::random(10) . "@example.com",
'confirmation_code' => $this->createDbHash(config('database.default')),
'confirmation_code' => $this->createDbHash($company->db),
]);
CompanyToken::unguard();

View File

@ -171,7 +171,7 @@ class SendRecurring implements ShouldQueue
$this->recurring_invoice->invitations->each(function ($recurring_invitation) use($invoice){
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($invoice->company->db);
$ii->invoice_id = $invoice->id;
$ii->client_contact_id = $recurring_invitation->client_contact_id;
$ii->save();

View File

@ -60,7 +60,7 @@ class CreateUser
$user->account_id = $this->account->id;
$user->password = $this->request['password'] ? bcrypt($this->request['password']) : '';
$user->accepted_terms_version = config('ninja.terms_version');
$user->confirmation_code = $this->createDbHash(config('database.default'));
$user->confirmation_code = $this->createDbHash($this->company->db);
$user->fill($this->request);
$user->email = $this->request['email']; //todo need to remove this in production
$user->last_login = now();

View File

@ -43,7 +43,7 @@ class CreateQuoteInvitation implements ShouldQueue
if (! $invitation && $contact->send_credit) {
$ii = QuoteInvitationFactory::create($quote->company_id, $quote->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($quote->company->db);
$ii->quote_id = $quote->id;
$ii->client_contact_id = $contact->id;
$ii->save();

View File

@ -277,7 +277,7 @@ class BaseRepository
$new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id);
$new_invitation->{$lcfirst_resource_id} = $model->id;
$new_invitation->client_contact_id = $contact->id;
$new_invitation->key = $this->createDbHash(config('database.default'));
$new_invitation->key = $this->createDbHash($model->company->db);
$new_invitation->save();
}

View File

@ -70,7 +70,7 @@ class UserRepository extends BaseRepository
}
if (!$user->confirmation_code) {
$user->confirmation_code = $this->createDbHash(config('database.default'));
$user->confirmation_code = $this->createDbHash($company->db);
}
$user->account_id = $account->id;

View File

@ -49,7 +49,7 @@ class CreateInvitations extends AbstractService
if (! $invitation) {
$ii = CreditInvitationFactory::create($this->credit->company_id, $this->credit->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($this->credit->company->db);
$ii->credit_id = $this->credit->id;
$ii->client_contact_id = $contact->id;
$ii->save();

View File

@ -51,7 +51,7 @@ class CreateInvitations extends AbstractService
if (! $invitation && $contact->send_email) {
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($this->invoice->company->db);
$ii->invoice_id = $this->invoice->id;
$ii->client_contact_id = $contact->id;
$ii->save();
@ -65,7 +65,7 @@ class CreateInvitations extends AbstractService
$contact = $this->createBlankContact();
$ii = InvoiceInvitationFactory::create($this->invoice->company_id, $this->invoice->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($this->invoice->company->db);
$ii->invoice_id = $this->invoice->id;
$ii->client_contact_id = $contact->id;
$ii->save();

View File

@ -77,7 +77,7 @@ class ConvertQuote
foreach($quote->invitations as $quote_invitation){
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($invoice->company->db);
$ii->client_contact_id = $quote_invitation->client_contact_id;
$invites[] = $ii;

View File

@ -50,7 +50,7 @@ class CreateInvitations
if (! $invitation && $contact->send_email) {
$ii = QuoteInvitationFactory::create($this->quote->company_id, $this->quote->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($this->quote->company->db);
$ii->quote_id = $this->quote->id;
$ii->client_contact_id = $contact->id;
$ii->save();

View File

@ -51,7 +51,7 @@ class CreateRecurringInvitations extends AbstractService
if (! $invitation && $contact->send_email) {
$ii = $this->invitation_factory::create($this->entity->company_id, $this->entity->user_id);
$ii->key = $this->createDbHash(config('database.default'));
$ii->key = $this->createDbHash($this->entity->company->db);
$ii->{$this->entity_id_name} = $this->entity->id;
$ii->client_contact_id = $contact->id;
$ii->save();