mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for contact registration
This commit is contained in:
parent
746dc07aa0
commit
3ac72b27cf
@ -18,12 +18,15 @@ use App\Http\Requests\ClientPortal\RegisterRequest;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class ContactRegisterController extends Controller
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(['guest']);
|
||||
@ -61,6 +64,16 @@ class ContactRegisterController extends Controller
|
||||
|
||||
$client->fill($data);
|
||||
$client->save();
|
||||
$client->number = $this->getNextClientNumber($client);
|
||||
$client->save();
|
||||
|
||||
if(!$client->country_id && strlen($client->company->settings->country_id) > 1){
|
||||
|
||||
$client->update(['country_id' => $client->company->settings->country_id]);
|
||||
|
||||
}
|
||||
|
||||
$this->getClientContact($data, $client);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
@ -44,30 +44,36 @@ class ContactRegister
|
||||
|
||||
}
|
||||
|
||||
$query = [
|
||||
'portal_domain' => $request->getSchemeAndHttpHost(),
|
||||
'portal_mode' => 'domain',
|
||||
];
|
||||
|
||||
if($company = Company::where($query)->first())
|
||||
if(Ninja::isHosted())
|
||||
{
|
||||
$query = [
|
||||
'portal_domain' => $request->getSchemeAndHttpHost(),
|
||||
'portal_mode' => 'domain',
|
||||
];
|
||||
|
||||
if(! $company->client_can_register)
|
||||
abort(400, 'Registration disabled');
|
||||
if($company = Company::where($query)->first())
|
||||
{
|
||||
|
||||
// $request->merge(['key' => $company->company_key]);
|
||||
session()->put('company_key', $company->company_key);
|
||||
if(! $company->client_can_register)
|
||||
abort(400, 'Registration disabled');
|
||||
|
||||
// $request->merge(['key' => $company->company_key]);
|
||||
session()->put('company_key', $company->company_key);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
// For self-hosted platforms with multiple companies, resolving is done using company key
|
||||
// if it doesn't resolve using a domain.
|
||||
if ($request->route()->parameter('company_key') && Ninja::isSelfHost()) {
|
||||
|
||||
if ($request->company_key && Ninja::isSelfHost()) {
|
||||
|
||||
$company = Company::where('company_key', $request->company_key)->firstOrFail();
|
||||
|
||||
if(! (bool)$company->client_can_register);
|
||||
if(! (bool)$company->client_can_register)
|
||||
abort(400, 'Registration disabled');
|
||||
|
||||
//$request->merge(['key' => $company->company_key]);
|
||||
|
@ -153,7 +153,7 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
'gateway_type_id' => GatewayType::BANK_TRANSFER,
|
||||
];
|
||||
|
||||
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||
$payment = $this->createPayment($data, Payment::STATUS_PENDING);
|
||||
|
||||
SystemLogger::dispatch(
|
||||
['response' => $payment, 'data' => $data],
|
||||
@ -242,7 +242,6 @@ class GoCardlessPaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach ($request->events as $event) {
|
||||
if ($event['action'] === 'confirmed') {
|
||||
$payment = Payment::query()
|
||||
|
@ -40,7 +40,7 @@
|
||||
class="input w-full"
|
||||
type="email"
|
||||
name="{{ $field['key'] }}"
|
||||
value="{{ old($field['key']) }}"
|
||||
value=""
|
||||
{{ $field['required'] ? 'required' : '' }} />
|
||||
@elseif($field['key'] === 'password')
|
||||
<input
|
||||
|
Loading…
x
Reference in New Issue
Block a user