diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index 7e18829e4c..4589bf548a 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -46,6 +46,10 @@ class ContactLoginController extends Controller MultiDB::findAndSetDbByCompanyKey($request->session()->get('company_key')); $company = Company::where('company_key', $request->input('company_key'))->first(); } + elseif($request->has('company_key')){ + MultiDB::findAndSetDbByCompanyKey($request->input('company_key')); + $company = Company::where('company_key', $request->input('company_key'))->first(); + } if ($company) { $account = $company->account; diff --git a/routes/client.php b/routes/client.php index c0d3e8492f..0da85644fd 100644 --- a/routes/client.php +++ b/routes/client.php @@ -18,8 +18,8 @@ use Illuminate\Support\Facades\Route; Route::get('client', [ContactLoginController::class, 'showLoginForm'])->name('client.catchall')->middleware(['domain_db', 'contact_account','locale']); //catch all -Route::get('client/login', [ContactLoginController::class, 'showLoginForm'])->name('client.login')->middleware(['domain_db', 'contact_account','locale']); -Route::post('client/login', [ContactLoginController::class, 'login'])->name('client.login.submit'); +Route::get('client/login/{company_key?}', [ContactLoginController::class, 'showLoginForm'])->name('client.login')->middleware(['domain_db', 'contact_account','locale']); +Route::post('client/login/{company_key?}', [ContactLoginController::class, 'login'])->name('client.login.submit'); Route::get('client/register/{company_key?}', [ContactRegisterController::class, 'showRegisterForm'])->name('client.register')->middleware(['domain_db', 'contact_account', 'contact_register','locale']); Route::post('client/register/{company_key?}', [ContactRegisterController::class, 'register'])->middleware(['domain_db', 'contact_account', 'contact_register', 'locale', 'throttle:10,1']);