mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 01:34:33 -04:00
Additional checks around quotas
This commit is contained in:
parent
a8b1c2cb8d
commit
b540a98ac6
@ -493,6 +493,10 @@ class InvoiceController extends BaseController
|
|||||||
return response(['message' => 'Please verify your account to send emails.'], 400);
|
return response(['message' => 'Please verify your account to send emails.'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Ninja::isHosted() && (stripos($action, 'email') !== false) && $user->account->emailQuotaExceeded()) {
|
||||||
|
return response(['message' => ctrans('texts.email_quota_exceeded_subject')], 400);
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array($request->action, ['auto_bill','mark_paid']) && $user->cannot('create', \App\Models\Payment::class)) {
|
if(in_array($request->action, ['auto_bill','mark_paid']) && $user->cannot('create', \App\Models\Payment::class)) {
|
||||||
return response(['message' => ctrans('texts.not_authorized'), 'errors' => ['ids' => [ctrans('texts.not_authorized')]]], 422);
|
return response(['message' => ctrans('texts.not_authorized'), 'errors' => ['ids' => [ctrans('texts.not_authorized')]]], 422);
|
||||||
}
|
}
|
||||||
|
@ -85,17 +85,23 @@ class SendEmailRequest extends Request
|
|||||||
private function checkUserAbleToSend()
|
private function checkUserAbleToSend()
|
||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
|
|
||||||
|
/** @var \App\Models\User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
if (Ninja::isHosted() && !auth()->user()->account->account_sms_verified) {
|
if (Ninja::isHosted() && !$user->account->account_sms_verified) {
|
||||||
$this->error_message = ctrans('texts.authorization_sms_failure');
|
$this->error_message = ctrans('texts.authorization_sms_failure');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Ninja::isHosted() && $user->account->emailQuotaExceeded()) {
|
||||||
|
$this->error_message = ctrans('texts.email_quota_exceeded_subject');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*Make sure we have all the require ingredients to send a template*/
|
/*Make sure we have all the require ingredients to send a template*/
|
||||||
if (isset($input['entity']) && array_key_exists('entity_id', $input) && is_string($input['entity']) && $input['entity_id']) {
|
if (isset($input['entity']) && array_key_exists('entity_id', $input) && is_string($input['entity']) && $input['entity_id']) {
|
||||||
|
|
||||||
/** @var \App\Models\User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
|
|
||||||
$company = $user->company();
|
$company = $user->company();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user