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