mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #6640 from turbo124/v5-develop
Improve initial email flow
This commit is contained in:
commit
d325d79e1e
@ -41,6 +41,10 @@ class ContactKeyLogin
|
||||
|
||||
if ($request->segment(2) && $request->segment(2) == 'magic_link' && $request->segment(3)) {
|
||||
$payload = Cache::get($request->segment(3));
|
||||
|
||||
if(!$payload)
|
||||
abort(403, 'Link expired.');
|
||||
|
||||
$contact_email = $payload['email'];
|
||||
|
||||
if($client_contact = ClientContact::where('email', $contact_email)->where('company_id', $payload['company_id'])->first()){
|
||||
|
@ -74,7 +74,6 @@ class StoreClientRequest extends Request
|
||||
$rules['number'] = ['nullable',Rule::unique('clients')->where('company_id', auth()->user()->company()->id)];
|
||||
$rules['id_number'] = ['nullable',Rule::unique('clients')->where('company_id', auth()->user()->company()->id)];
|
||||
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,10 @@ class Request extends FormRequest
|
||||
|
||||
if (isset($input['contacts']) && is_array($input['contacts'])) {
|
||||
foreach ($input['contacts'] as $key => $contact) {
|
||||
|
||||
if(!is_array($contact))
|
||||
continue;
|
||||
|
||||
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
|
||||
unset($input['contacts'][$key]['id']);
|
||||
} elseif (array_key_exists('id', $contact) && is_string($contact['id'])) {
|
||||
@ -154,6 +158,7 @@ class Request extends FormRequest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class CreateAccount
|
||||
{
|
||||
@ -114,8 +115,22 @@ class CreateAccount
|
||||
|
||||
$spaa9f78->fresh();
|
||||
|
||||
if(Ninja::isHosted())
|
||||
if(Ninja::isHosted()){
|
||||
nlog("welcome");
|
||||
App::forgetInstance('translator');
|
||||
$t = app('translator');
|
||||
$t->replace(Ninja::transformTranslations($sp035a66->settings));
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new \Modules\Admin\Mail\Welcome($sp035a66->owner());
|
||||
$nmo->company = $sp035a66;
|
||||
$nmo->settings = $sp035a66->settings;
|
||||
$nmo->to_user = $sp035a66->owner();
|
||||
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
|
||||
\Modules\Admin\Jobs\Account\NinjaUser::dispatch([], $sp035a66);
|
||||
}
|
||||
|
||||
VersionCheck::dispatch();
|
||||
|
||||
@ -123,6 +138,9 @@ class CreateAccount
|
||||
->increment()
|
||||
->batch();
|
||||
|
||||
|
||||
|
||||
|
||||
return $sp794f3f;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ class CompanyImport implements ShouldQueue
|
||||
{
|
||||
|
||||
$this->genericImport(Client::class,
|
||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'gateway_tokens', 'contacts', 'documents'],
|
||||
['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'gateway_tokens', 'contacts', 'documents','country'],
|
||||
[['users' => 'user_id'], ['users' => 'assigned_user_id']],
|
||||
'clients',
|
||||
'number');
|
||||
@ -496,7 +496,7 @@ class CompanyImport implements ShouldQueue
|
||||
{
|
||||
|
||||
$this->genericImport(ClientContact::class,
|
||||
['user_id', 'company_id', 'id', 'hashed_id'],
|
||||
['user_id', 'company_id', 'id', 'hashed_id','company'],
|
||||
[['users' => 'user_id'], ['clients' => 'client_id']],
|
||||
'client_contacts',
|
||||
'email');
|
||||
|
@ -82,8 +82,7 @@ class CreateUser
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
if(!Ninja::isSelfHost()){
|
||||
nlog("in the create user class");
|
||||
if(!Ninja::isSelfHost()) {
|
||||
event(new UserWasCreated($user, $user, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class SendVerificationNotification implements ShouldQueue
|
||||
{
|
||||
@ -53,17 +54,20 @@ class SendVerificationNotification implements ShouldQueue
|
||||
|
||||
$event->user->service()->invite($event->company);
|
||||
|
||||
App::forgetInstance('translator');
|
||||
$t = app('translator');
|
||||
$t->replace(Ninja::transformTranslations($event->company->settings));
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new UserAdded($event->company, $event->creating_user, $event->user);
|
||||
$nmo->company = $event->company;
|
||||
$nmo->settings = $event->company->settings;
|
||||
$nmo->to_user = $event->creating_user;
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
if(Carbon::parse($event->company->created_at)->lt(now()->subDay()))
|
||||
{
|
||||
App::forgetInstance('translator');
|
||||
$t = app('translator');
|
||||
$t->replace(Ninja::transformTranslations($event->company->settings));
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new UserAdded($event->company, $event->creating_user, $event->user);
|
||||
$nmo->company = $event->company;
|
||||
$nmo->settings = $event->company->settings;
|
||||
$nmo->to_user = $event->creating_user;
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,9 @@ class InvoiceMigrationRepository extends BaseRepository
|
||||
$model->save();
|
||||
}
|
||||
|
||||
if($data['deleted_at'])
|
||||
if($data['deleted_at'] == '0000-00-00 00:00:00.000000')
|
||||
$model->deleted_at = null;
|
||||
else if($data['deleted_at'])
|
||||
$model->delete();
|
||||
|
||||
$model->save();
|
||||
|
@ -228,6 +228,8 @@ class HtmlEngine
|
||||
$data['$invoice.taxes'] = &$data['$taxes'];
|
||||
|
||||
$data['$user.name'] = ['value' => $this->entity->user->present()->name(), 'label' => ctrans('texts.name')];
|
||||
$data['$user.first_name'] = ['value' => $this->entity->user->first_name, 'label' => ctrans('texts.first_name')];
|
||||
$data['$user.last_name'] = ['value' => $this->entity->user->last_name, 'label' => ctrans('texts.last_name')];
|
||||
$data['$user_iban'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company1', $this->settings->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company1')];
|
||||
$data['$invoice.custom1'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'invoice1', $this->entity->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'invoice1')];
|
||||
$data['$invoice.custom2'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'invoice2', $this->entity->custom_value2, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'invoice2')];
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,7 @@ input:checked ~ .dot {
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">Custom background for invoices & quotes</div>
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">Integrate with Zapier, Integromat or API</div>
|
||||
<div class="py-2 text-sm my-3 text-white">Priority support</div>
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">+ Much more!</div>
|
||||
|
||||
@ -194,7 +194,7 @@ input:checked ~ .dot {
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">Custom background for invoices & quotes</div>
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">Integrate with Zapier, Integromat or API</div>
|
||||
<div class="py-2 text-sm my-3 text-white">Priority support</div>
|
||||
<hr>
|
||||
<div class="py-2 text-sm my-3 text-white">+ Much more!</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user