mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for client portal login with custom domains
This commit is contained in:
parent
e2a8196107
commit
0dc4d9567c
@ -37,9 +37,11 @@ class ContactLoginController extends Controller
|
||||
public function showLoginForm(Request $request)
|
||||
{
|
||||
//if we are on the root domain invoicing.co do not show any company logos
|
||||
if(Ninja::isHosted() && count(explode('.', request()->getHost())) == 2){
|
||||
$company = null;
|
||||
}elseif (strpos($request->getHost(), 'invoicing.co') !== false) {
|
||||
// if(Ninja::isHosted() && count(explode('.', request()->getHost())) == 2){
|
||||
// $company = null;
|
||||
// }else
|
||||
|
||||
if (strpos($request->getHost(), 'invoicing.co') !== false) {
|
||||
$subdomain = explode('.', $request->getHost())[0];
|
||||
|
||||
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
@ -65,14 +66,18 @@ class ContactResetPasswordController extends Controller
|
||||
{
|
||||
$account_id = $request->get('account_id');
|
||||
$account = Account::find($account_id);
|
||||
$db = $account->companies->first()->db;
|
||||
|
||||
return $this->render('auth.passwords.reset')->with(
|
||||
['token' => $token, 'email' => $request->email, 'account' => $account]
|
||||
['token' => $token, 'email' => $request->email, 'account' => $account, 'db' => $db]
|
||||
);
|
||||
}
|
||||
|
||||
public function reset(Request $request)
|
||||
{
|
||||
if($request->has('db'))
|
||||
MultiDB::setDb($request->input('db'));
|
||||
|
||||
$request->validate($this->rules(), $this->validationErrorMessages());
|
||||
|
||||
// Here we will attempt to reset the user's password. If it is successful we
|
||||
|
@ -52,7 +52,7 @@
|
||||
<a class="text-xs text-gray-600 hover:text-gray-800 ease-in duration-100"
|
||||
href="{{ route('client.password.request') }}">{{ trans('texts.forgot_password') }}</a>
|
||||
</div>
|
||||
@if($company)
|
||||
@if(isset($company) && !is_null($company))
|
||||
<input type="hidden" name="db" value="{{$company->db}}">
|
||||
@endif
|
||||
<input type="password" name="password" id="password"
|
||||
|
@ -30,6 +30,9 @@
|
||||
<form action="{{ route('client.password.update') }}" method="post" class="mt-6">
|
||||
@csrf
|
||||
<input type="hidden" name="token" value="{{ $token }}">
|
||||
@if($db)
|
||||
<input type="hidden" name="db" value="{{$db}}">
|
||||
@endif
|
||||
<div class="flex flex-col">
|
||||
<label for="email" class="input-label">{{ ctrans('texts.email_address') }}</label>
|
||||
<input type="email" name="email" id="email"
|
||||
|
Loading…
x
Reference in New Issue
Block a user