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
d8f5aeb85c
commit
e6eb899f79
@ -19,10 +19,36 @@ class ContactRegister
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
// Resolving based on subdomain. Used in version 5 hosted platform.
|
||||
if ($request->subdomain) {
|
||||
$company = Company::where('subdomain', $request->subdomain)->firstOrFail();
|
||||
|
||||
if (strpos($request->getHost(), 'invoicing.co') !== false)
|
||||
{
|
||||
$subdomain = explode('.', $request->getHost())[0];
|
||||
|
||||
$query = [
|
||||
'subdomain' => $subdomain,
|
||||
'portal_mode' => 'subdomain',
|
||||
];
|
||||
|
||||
$company = Company::where($query)->first();
|
||||
|
||||
if($company)
|
||||
{
|
||||
abort_unless($company->getSetting('enable_client_registration'), 404);
|
||||
|
||||
$request->merge(['key' => $company->company_key]);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$query = [
|
||||
'portal_domain' => $request->getSchemeAndHttpHost(),
|
||||
'portal_mode' => 'domain',
|
||||
];
|
||||
|
||||
if($company = Company::where($query)->first())
|
||||
{
|
||||
abort_unless($company->getSetting('enable_client_registration'), 404);
|
||||
|
||||
$request->merge(['key' => $company->company_key]);
|
||||
@ -30,6 +56,7 @@ class ContactRegister
|
||||
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()) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
.register<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
@ -8,7 +8,7 @@ Route::get('client/login', 'Auth\ContactLoginController@showLoginForm')->name('c
|
||||
Route::post('client/login', 'Auth\ContactLoginController@login')->name('client.login.submit');
|
||||
|
||||
Route::get('client/register/{company_key?}', 'Auth\ContactRegisterController@showRegisterForm')->name('client.register')->middleware(['domain_db', 'contact_account','locale']);
|
||||
Route::post('client/register/{company_key?}', 'Auth\ContactRegisterController@register');
|
||||
Route::post('client/register/{company_key?}', 'Auth\ContactRegisterController@register')->middleware(['domain_db', 'contact_account','locale']);
|
||||
|
||||
Route::get('client/password/reset', 'Auth\ContactForgotPasswordController@showLinkRequestForm')->name('client.password.request')->middleware(['domain_db', 'contact_account','locale']);
|
||||
Route::post('client/password/email', 'Auth\ContactForgotPasswordController@sendResetLinkEmail')->name('client.password.email')->middleware('locale');
|
||||
|
Loading…
x
Reference in New Issue
Block a user