mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:37:34 -05:00 
			
		
		
		
	Merge branch 'v2' into v2-2606-client-portal-improvements
This commit is contained in:
		
						commit
						3e3dd95262
					
				@ -44,8 +44,12 @@ class PaymentMethodController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $gateway = auth()->user()->client->getCreditCardGateway();
 | 
			
		||||
 | 
			
		||||
        return $gateway->driver(auth()->user()->client)->authorizeView(GatewayType::CREDIT_CARD);
 | 
			
		||||
        $data['gateway'] = $gateway;
 | 
			
		||||
 | 
			
		||||
        return $gateway
 | 
			
		||||
            ->driver(auth()->user()->client)
 | 
			
		||||
            ->setPaymentMethod(GatewayType::BANK_TRANSFER)
 | 
			
		||||
            ->authorizeView($data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -58,8 +62,10 @@ class PaymentMethodController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $gateway = auth()->user()->client->getCreditCardGateway();
 | 
			
		||||
 | 
			
		||||
        return $gateway->driver(auth()->user()->client)->authorizeResponseView($request->all());
 | 
			
		||||
 | 
			
		||||
        return $gateway
 | 
			
		||||
            ->driver(auth()->user()->client)
 | 
			
		||||
            ->setPaymentMethod(GatewayType::BANK_TRANSFER)
 | 
			
		||||
            ->authorizeResponse($request);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -104,7 +110,7 @@ class PaymentMethodController extends Controller
 | 
			
		||||
 | 
			
		||||
        return $gateway
 | 
			
		||||
            ->driver(auth()->user()->client)
 | 
			
		||||
            ->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH')
 | 
			
		||||
            ->setPaymentMethod(GatewayType::BANK_TRANSFER)
 | 
			
		||||
            ->verificationView($payment_method);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -114,7 +120,7 @@ class PaymentMethodController extends Controller
 | 
			
		||||
 | 
			
		||||
        return $gateway
 | 
			
		||||
            ->driver(auth()->user()->client)
 | 
			
		||||
            ->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH')
 | 
			
		||||
            ->setPaymentMethod(GatewayType::BANK_TRANSFER)
 | 
			
		||||
            ->processVerification($payment_method);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ namespace App\Http\Controllers\Traits;
 | 
			
		||||
use App\Models\User;
 | 
			
		||||
use App\Utils\Traits\UserSessionAttributes;
 | 
			
		||||
use Illuminate\Support\Facades\Auth;
 | 
			
		||||
use Illuminate\Support\Facades\Hash;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class VerifiesUserEmail
 | 
			
		||||
@ -30,7 +31,18 @@ trait VerifiesUserEmail
 | 
			
		||||
     */
 | 
			
		||||
    public function confirm()
 | 
			
		||||
    {
 | 
			
		||||
        if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->route('confirmation_code'))->first()) {
 | 
			
		||||
        $user = User::where('confirmation_code', request()->confirmation_code)->first();
 | 
			
		||||
        
 | 
			
		||||
        // if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->input('confirmation_code'))->first()) {
 | 
			
		||||
 | 
			
		||||
        if (!$user) {
 | 
			
		||||
            return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (is_null($user->password) || empty($user->password)) {
 | 
			
		||||
            return $this->render('auth.confirmation_with_password', ['root' => 'themes']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $user->email_verified_at = now();
 | 
			
		||||
        $user->confirmation_code = null;
 | 
			
		||||
        $user->save();
 | 
			
		||||
@ -41,9 +53,27 @@ trait VerifiesUserEmail
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function confirmWithPassword()
 | 
			
		||||
    {
 | 
			
		||||
        $user = User::where('confirmation_code', request()->confirmation_code)->first();
 | 
			
		||||
 | 
			
		||||
        if (!$user) {
 | 
			
		||||
            return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        request()->validate([
 | 
			
		||||
            'password' => ['required', 'min:6', 'confirmed'],
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $user->password = Hash::make(request()->password);
 | 
			
		||||
 | 
			
		||||
        $user->email_verified_at = now();
 | 
			
		||||
        $user->confirmation_code = null;
 | 
			
		||||
        $user->save();
 | 
			
		||||
 | 
			
		||||
        return $this->render('auth.confirmed', [
 | 
			
		||||
            'root' => 'themes',
 | 
			
		||||
            'message' => ctrans('texts.wrong_confirmation'),
 | 
			
		||||
            'message' => ctrans('texts.security_confirmation'),
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -172,7 +172,7 @@ class StripePaymentDriver extends BasePaymentDriver
 | 
			
		||||
 | 
			
		||||
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 | 
			
		||||
     */
 | 
			
		||||
    public function authorizeCreditCardResponse($request)
 | 
			
		||||
    public function authorizeResponse($request)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->payment_method->authorizeResponse($request);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -3224,6 +3224,7 @@ return [
 | 
			
		||||
    'year_invalid' => 'Provided year is not valid.',
 | 
			
		||||
 | 
			
		||||
    'if_you_need_help' => 'If you need help you can either post to our',    
 | 
			
		||||
    
 | 
			
		||||
    'reversed' => 'Reversed',
 | 
			
		||||
    'update_password_on_confirm' => 'After updating password, your account will be confirmed.',
 | 
			
		||||
    'bank_account_not_linked' => 'To pay with bank account, first you have to add it as payment method.',
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@
 | 
			
		||||
@section('meta_title', ctrans('texts.ach'))
 | 
			
		||||
 | 
			
		||||
@section('body')
 | 
			
		||||
    @if($token)
 | 
			
		||||
        <form action="{{ route('client.payments.response') }}" method="post" id="server-response">
 | 
			
		||||
            @csrf
 | 
			
		||||
            @foreach($invoices as $invoice)
 | 
			
		||||
@ -14,6 +15,7 @@
 | 
			
		||||
            <input type="hidden" name="currency" value="{{ $currency }}">
 | 
			
		||||
            <input type="hidden" name="customer" value="{{ $customer->id }}">
 | 
			
		||||
        </form>
 | 
			
		||||
    @endif
 | 
			
		||||
 | 
			
		||||
    <div class="container mx-auto">
 | 
			
		||||
        <div class="grid grid-cols-6 gap-4">
 | 
			
		||||
@ -29,6 +31,7 @@
 | 
			
		||||
                        </p>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div>
 | 
			
		||||
                        @if($token)
 | 
			
		||||
                            <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
 | 
			
		||||
                                <dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
 | 
			
		||||
                                    {{ ctrans('texts.payment_type') }}
 | 
			
		||||
@ -50,6 +53,14 @@
 | 
			
		||||
                                    {{ ctrans('texts.pay_now') }}
 | 
			
		||||
                                </button>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        @else
 | 
			
		||||
                            <div class="bg-gray-50 px-4 py-5 sm:px-6 flex items-center">
 | 
			
		||||
                                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                                   <span>{{ ctrans('texts.bank_account_not_linked') }}</span>
 | 
			
		||||
                                   <a class="button button-link" href="{{ route('client.payment_methods.index') }}">{{ ctrans('texts.add_payment_method') }}</a>
 | 
			
		||||
                                </dd>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        @endif
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,43 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.clean')
 | 
			
		||||
@section('meta_title', ctrans('texts.set_password'))
 | 
			
		||||
 | 
			
		||||
@section('body')
 | 
			
		||||
    <div class="flex h-screen">
 | 
			
		||||
        <div class="m-auto md:w-1/3 lg:w-1/5">
 | 
			
		||||
            <div class="flex flex-col">
 | 
			
		||||
                <img src="{{ asset('images/invoiceninja-black-logo-2.png') }}" class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
 | 
			
		||||
                <h1 class="text-center text-3xl mt-10">{{ ctrans('texts.set_password') }}</h1>
 | 
			
		||||
                <span class="text-gray-900 text-sm text-center">{{ ctrans('texts.update_password_on_confirm') }}</span>
 | 
			
		||||
 | 
			
		||||
                <form action="{{ url()->current() }}" method="post" class="mt-6">
 | 
			
		||||
                    @csrf
 | 
			
		||||
                    <div class="flex flex-col mt-4">
 | 
			
		||||
                        <label for="password" class="input-label">{{ ctrans('texts.password') }}</label>
 | 
			
		||||
                        <input type="password" name="password" id="password"
 | 
			
		||||
                               class="input"
 | 
			
		||||
                               autofocus>
 | 
			
		||||
                        @error('password')
 | 
			
		||||
                        <div class="validation validation-fail">
 | 
			
		||||
                            {{ $message }}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        @enderror
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="flex flex-col mt-4">
 | 
			
		||||
                        <label for="password" class="input-label">{{ ctrans('texts.password_confirmation') }}</label>
 | 
			
		||||
                        <input type="password" name="password_confirmation" id="password_confirmation"
 | 
			
		||||
                               class="input"
 | 
			
		||||
                               autofocus>
 | 
			
		||||
                        @error('password_confirmation')
 | 
			
		||||
                        <div class="validation validation-fail">
 | 
			
		||||
                            {{ $message }}
 | 
			
		||||
                        </div>
 | 
			
		||||
                        @enderror
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="mt-5">
 | 
			
		||||
                        <button class="button button-primary button-block">{{ ctrans('texts.update') }}</button>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
@ -38,7 +38,7 @@
 | 
			
		||||
                        @enderror
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="flex flex-col mt-4">
 | 
			
		||||
                        <label for="password" class="input-label">{{ ctrans('texts.password') }}</label>
 | 
			
		||||
                        <label for="password" class="input-label">{{ ctrans('texts.password_confirmation') }}</label>
 | 
			
		||||
                        <input type="password" name="password_confirmation" id="password_confirmation"
 | 
			
		||||
                               class="input"
 | 
			
		||||
                               autofocus>
 | 
			
		||||
 | 
			
		||||
@ -30,4 +30,5 @@ Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('passw
 | 
			
		||||
 */
 | 
			
		||||
Route::group(['middleware' => ['url_db']], function () {
 | 
			
		||||
    Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm');
 | 
			
		||||
    Route::post('/user/confirm/{confirmation_code}', 'UserController@confirmWithPassword');
 | 
			
		||||
});
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user