mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 23:04:36 -04: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();
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,9 +61,11 @@ class PaymentMethodController extends Controller
|
|||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$gateway = auth()->user()->client->getCreditCardGateway();
|
$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
|
return $gateway
|
||||||
->driver(auth()->user()->client)
|
->driver(auth()->user()->client)
|
||||||
->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH')
|
->setPaymentMethod(GatewayType::BANK_TRANSFER)
|
||||||
->verificationView($payment_method);
|
->verificationView($payment_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +120,7 @@ class PaymentMethodController extends Controller
|
|||||||
|
|
||||||
return $gateway
|
return $gateway
|
||||||
->driver(auth()->user()->client)
|
->driver(auth()->user()->client)
|
||||||
->setPaymentMethod('App\\PaymentDrivers\\Stripe\\ACH')
|
->setPaymentMethod(GatewayType::BANK_TRANSFER)
|
||||||
->processVerification($payment_method);
|
->processVerification($payment_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace App\Http\Controllers\Traits;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Utils\Traits\UserSessionAttributes;
|
use App\Utils\Traits\UserSessionAttributes;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class VerifiesUserEmail
|
* Class VerifiesUserEmail
|
||||||
@ -30,20 +31,49 @@ trait VerifiesUserEmail
|
|||||||
*/
|
*/
|
||||||
public function confirm()
|
public function confirm()
|
||||||
{
|
{
|
||||||
if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->route('confirmation_code'))->first()) {
|
$user = User::where('confirmation_code', request()->confirmation_code)->first();
|
||||||
$user->email_verified_at = now();
|
|
||||||
$user->confirmation_code = null;
|
// if ($user = User::whereRaw("BINARY `confirmation_code`= ?", request()->input('confirmation_code'))->first()) {
|
||||||
$user->save();
|
|
||||||
|
|
||||||
return $this->render('auth.confirmed', [
|
if (!$user) {
|
||||||
'root' => 'themes',
|
return $this->render('auth.confirmed', ['root' => 'themes', 'message' => ctrans('texts.wrong_confirmation')]);
|
||||||
'message' => ctrans('texts.security_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();
|
||||||
|
|
||||||
return $this->render('auth.confirmed', [
|
return $this->render('auth.confirmed', [
|
||||||
'root' => 'themes',
|
'root' => 'themes',
|
||||||
'message' => ctrans('texts.wrong_confirmation'),
|
'message' => ctrans('texts.security_confirmation'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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.security_confirmation'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function authorizeCreditCardResponse($request)
|
public function authorizeResponse($request)
|
||||||
{
|
{
|
||||||
return $this->payment_method->authorizeResponse($request);
|
return $this->payment_method->authorizeResponse($request);
|
||||||
}
|
}
|
||||||
|
@ -3223,7 +3223,8 @@ return [
|
|||||||
'month_invalid' => 'Provided month is not valid.',
|
'month_invalid' => 'Provided month is not valid.',
|
||||||
'year_invalid' => 'Provided year is not valid.',
|
'year_invalid' => 'Provided year is not valid.',
|
||||||
|
|
||||||
'if_you_need_help' => 'If you need help you can either post to our',
|
'if_you_need_help' => 'If you need help you can either post to our',
|
||||||
|
|
||||||
'reversed' => 'Reversed',
|
'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,18 +2,20 @@
|
|||||||
@section('meta_title', ctrans('texts.ach'))
|
@section('meta_title', ctrans('texts.ach'))
|
||||||
|
|
||||||
@section('body')
|
@section('body')
|
||||||
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
|
@if($token)
|
||||||
@csrf
|
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
|
||||||
@foreach($invoices as $invoice)
|
@csrf
|
||||||
<input type="hidden" name="hashed_ids[]" value="{{ $invoice->hashed_id }}">
|
@foreach($invoices as $invoice)
|
||||||
@endforeach
|
<input type="hidden" name="hashed_ids[]" value="{{ $invoice->hashed_id }}">
|
||||||
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
|
@endforeach
|
||||||
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
|
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
|
||||||
<input type="hidden" name="source" value="{{ $token->meta->id }}">
|
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
|
||||||
<input type="hidden" name="amount" value="{{ $amount }}">
|
<input type="hidden" name="source" value="{{ $token->meta->id }}">
|
||||||
<input type="hidden" name="currency" value="{{ $currency }}">
|
<input type="hidden" name="amount" value="{{ $amount }}">
|
||||||
<input type="hidden" name="customer" value="{{ $customer->id }}">
|
<input type="hidden" name="currency" value="{{ $currency }}">
|
||||||
</form>
|
<input type="hidden" name="customer" value="{{ $customer->id }}">
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="container mx-auto">
|
<div class="container mx-auto">
|
||||||
<div class="grid grid-cols-6 gap-4">
|
<div class="grid grid-cols-6 gap-4">
|
||||||
@ -29,27 +31,36 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
@if($token)
|
||||||
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
||||||
{{ ctrans('texts.payment_type') }}
|
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
||||||
</dt>
|
{{ ctrans('texts.payment_type') }}
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
</dt>
|
||||||
{{ ctrans('texts.ach') }} ({{ ctrans('texts.bank_transfer') }}) (****{{ $token->meta->last4 }})
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
</dd>
|
{{ ctrans('texts.ach') }} ({{ ctrans('texts.bank_transfer') }}) (****{{ $token->meta->last4 }})
|
||||||
</div>
|
</dd>
|
||||||
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
</div>
|
||||||
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
||||||
{{ ctrans('texts.amount') }}
|
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
||||||
</dt>
|
{{ ctrans('texts.amount') }}
|
||||||
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
</dt>
|
||||||
<span class="font-bold">{{ App\Utils\Number::formatMoney($amount, $client) }}</span>
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
</dd>
|
<span class="font-bold">{{ App\Utils\Number::formatMoney($amount, $client) }}</span>
|
||||||
</div>
|
</dd>
|
||||||
<div class="bg-gray-50 px-4 py-5 flex justify-end">
|
</div>
|
||||||
<button type="button" id="pay-now" class="button button-primary" onclick="document.getElementById('server-response').submit()">
|
<div class="bg-gray-50 px-4 py-5 flex justify-end">
|
||||||
{{ ctrans('texts.pay_now') }}
|
<button type="button" id="pay-now" class="button button-primary" onclick="document.getElementById('server-response').submit()">
|
||||||
</button>
|
{{ ctrans('texts.pay_now') }}
|
||||||
</div>
|
</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>
|
</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
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col mt-4">
|
<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"
|
<input type="password" name="password_confirmation" id="password_confirmation"
|
||||||
class="input"
|
class="input"
|
||||||
autofocus>
|
autofocus>
|
||||||
|
@ -30,4 +30,5 @@ Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('passw
|
|||||||
*/
|
*/
|
||||||
Route::group(['middleware' => ['url_db']], function () {
|
Route::group(['middleware' => ['url_db']], function () {
|
||||||
Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm');
|
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