diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 0bcf9a76ae7e..a03a0b41b4b7 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -507,6 +507,9 @@ class CreditController extends BaseController $ids = request()->input('ids'); + if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified) + return response(['message' => 'Please verify your account to send emails.'], 400); + $credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); if (! $credits) { diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index e6276ae898d8..73b25465ce13 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -128,6 +128,9 @@ class EmailController extends BaseController 'body' => $body, ]; + if(Ninja::isHosted() && !$entity_obj->company->account->account_sms_verified) + return response(['message' => 'Please verify your account to send emails.'], 400); + if($entity == 'purchaseOrder' || $template == 'purchase_order'){ return $this->sendPurchaseOrder($entity_obj, $data); } diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 951b6552b9b0..6a7abf82c066 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -551,6 +551,9 @@ class InvoiceController extends BaseController $ids = request()->input('ids'); + if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified) + return response(['message' => 'Please verify your account to send emails.'], 400); + $invoices = Invoice::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); if (! $invoices) { diff --git a/app/Http/Controllers/PurchaseOrderController.php b/app/Http/Controllers/PurchaseOrderController.php index 959ed9f1ce18..bf8dc737c659 100644 --- a/app/Http/Controllers/PurchaseOrderController.php +++ b/app/Http/Controllers/PurchaseOrderController.php @@ -489,6 +489,9 @@ class PurchaseOrderController extends BaseController $ids = request()->input('ids'); + if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified) + return response(['message' => 'Please verify your account to send emails.'], 400); + $purchase_orders = PurchaseOrder::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); if (! $purchase_orders) { diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 9280165db249..a9c1f5b7113e 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -518,6 +518,9 @@ class QuoteController extends BaseController $ids = request()->input('ids'); + if(Ninja::isHosted() && in_array('email', $action) && !auth()->user()->company()->account->account_sms_verified) + return response(['message' => 'Please verify your account to send emails.'], 400); + $quotes = Quote::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); if (! $quotes) { diff --git a/app/Http/Controllers/TwilioController.php b/app/Http/Controllers/TwilioController.php new file mode 100644 index 000000000000..1c9760eb1a74 --- /dev/null +++ b/app/Http/Controllers/TwilioController.php @@ -0,0 +1,96 @@ +user()->company()->account; + + if(MultiDB::hasPhoneNumber($request->phone)) + return response()->json(['message' => 'This phone number has already been verified with another account'], 400); + + $sid = config('ninja.twilio_account_sid'); + $token = config('ninja.twilio_auth_token'); + + $twilio = new Client($sid, $token); + + $verification = $twilio->verify->v2->services(config('ninja.twilio_verify_sid')) + ->verifications + ->create($request->phone, "sms"); + + $account->account_sms_verification_code = $verification->sid; + $account->account_sms_verification_number = $request->phone; + $account->save(); + + return response()->json(['message' => 'Code sent.'], 200); + } + + /** + * Show the form for creating a new resource. + * + * @return void + */ + public function confirm(ConfirmSmsRequest $request) + { + + $account = auth()->user()->company()->account; + + $sid = config('ninja.twilio_account_sid'); + $token = config('ninja.twilio_auth_token'); + + $twilio = new Client($sid, $token); + + $verification_check = $twilio->verify + ->v2 + ->services(config('ninja.twilio_verify_sid')) + ->verificationChecks + ->create([ + "to" => $account->account_sms_verification_number, + "code" => $request->code + ]); + + + if($verification_check->status == 'approved'){ + + $account->account_sms_verified = true; + $account->save(); + + return response()->json(['message' => 'SMS verified'], 200); + } + + + return response()->json(['message' => 'SMS not verified'], 400); + + + } + +} diff --git a/app/Http/Requests/Twilio/ConfirmSmsRequest.php b/app/Http/Requests/Twilio/ConfirmSmsRequest.php new file mode 100644 index 000000000000..537dcbab7da4 --- /dev/null +++ b/app/Http/Requests/Twilio/ConfirmSmsRequest.php @@ -0,0 +1,38 @@ +user()->isAdmin(); + } + + public function rules() + { + + return [ + 'code' => 'required', + ]; + } + +} diff --git a/app/Http/Requests/Twilio/GenerateSmsRequest.php b/app/Http/Requests/Twilio/GenerateSmsRequest.php new file mode 100644 index 000000000000..78674727179e --- /dev/null +++ b/app/Http/Requests/Twilio/GenerateSmsRequest.php @@ -0,0 +1,39 @@ +user()->isAdmin(); + } + + + public function rules() + { + + return [ + 'phone' => 'required|regex:^\+[1-9]\d{1,14}$', + ]; + + } +} diff --git a/app/Jobs/Entity/EmailEntity.php b/app/Jobs/Entity/EmailEntity.php index cc3cd03ba33a..c1fa439068e5 100644 --- a/app/Jobs/Entity/EmailEntity.php +++ b/app/Jobs/Entity/EmailEntity.php @@ -108,6 +108,9 @@ class EmailEntity implements ShouldQueue /* Set DB */ MultiDB::setDB($this->company->db); + if(Ninja::isHosted() && !$this->company->account->account_sms_verified) + return; + App::forgetInstance('translator'); $t = app('translator'); App::setLocale($this->invitation->contact->preferredLocale()); diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index c8c0b10274b5..46bce69240ed 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -88,6 +88,7 @@ class AccountTransformer extends EntityTransformer 'is_hosted' => (bool) Ninja::isHosted(), 'set_react_as_default_ap' => (bool) $account->set_react_as_default_ap, 'trial_days_left' => Ninja::isHosted() ? (int) $account->getTrialDays() : 0, + 'account_sms_verified' => (bool) $account->account_sms_verified, ]; } diff --git a/composer.lock b/composer.lock index 742fa823028e..d7618895d817 100644 --- a/composer.lock +++ b/composer.lock @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.231.10", + "version": "3.231.14", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "e46b7c5fcb70fadf38079755982cc1d3f0583c41" + "reference": "6b79b9c8204813d9674ffa7badcd567d7f608165" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e46b7c5fcb70fadf38079755982cc1d3f0583c41", - "reference": "e46b7c5fcb70fadf38079755982cc1d3f0583c41", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6b79b9c8204813d9674ffa7badcd567d7f608165", + "reference": "6b79b9c8204813d9674ffa7badcd567d7f608165", "shasum": "" }, "require": { @@ -464,9 +464,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.231.10" + "source": "https://github.com/aws/aws-sdk-php/tree/3.231.14" }, - "time": "2022-07-20T18:17:18+00:00" + "time": "2022-07-26T18:20:14+00:00" }, { "name": "bacon/bacon-qr-code", @@ -576,16 +576,16 @@ }, { "name": "braintree/braintree_php", - "version": "6.8.0", + "version": "6.9.0", "source": { "type": "git", "url": "https://github.com/braintree/braintree_php.git", - "reference": "d5d92080d67ed247b72378e4f47e8c4d0048bddd" + "reference": "096984f01c03e47e053703fb159721cb77793587" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/braintree/braintree_php/zipball/d5d92080d67ed247b72378e4f47e8c4d0048bddd", - "reference": "d5d92080d67ed247b72378e4f47e8c4d0048bddd", + "url": "https://api.github.com/repos/braintree/braintree_php/zipball/096984f01c03e47e053703fb159721cb77793587", + "reference": "096984f01c03e47e053703fb159721cb77793587", "shasum": "" }, "require": { @@ -619,9 +619,9 @@ "description": "Braintree PHP Client Library", "support": { "issues": "https://github.com/braintree/braintree_php/issues", - "source": "https://github.com/braintree/braintree_php/tree/6.8.0" + "source": "https://github.com/braintree/braintree_php/tree/6.9.0" }, - "time": "2022-04-01T18:37:18+00:00" + "time": "2022-07-25T14:01:57+00:00" }, { "name": "brick/math", @@ -2044,16 +2044,16 @@ }, { "name": "gocardless/gocardless-pro", - "version": "4.19.0", + "version": "4.20.0", "source": { "type": "git", "url": "https://github.com/gocardless/gocardless-pro-php.git", - "reference": "ed88cd22b6a790ee37758afa8bf7c9d43caa796c" + "reference": "3df49bbc748900fba6cb3de428c21e488b058940" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/ed88cd22b6a790ee37758afa8bf7c9d43caa796c", - "reference": "ed88cd22b6a790ee37758afa8bf7c9d43caa796c", + "url": "https://api.github.com/repos/gocardless/gocardless-pro-php/zipball/3df49bbc748900fba6cb3de428c21e488b058940", + "reference": "3df49bbc748900fba6cb3de428c21e488b058940", "shasum": "" }, "require": { @@ -2093,9 +2093,9 @@ ], "support": { "issues": "https://github.com/gocardless/gocardless-pro-php/issues", - "source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.19.0" + "source": "https://github.com/gocardless/gocardless-pro-php/tree/v4.20.0" }, - "time": "2022-07-13T14:44:43+00:00" + "time": "2022-07-25T09:57:58+00:00" }, { "name": "google/apiclient", @@ -2169,16 +2169,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.258.0", + "version": "v0.259.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "71eb32534aba05e373fe317c1373a9645065881c" + "reference": "3f68a8b8f825974bc0318b8f7268a09216d5fee1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/71eb32534aba05e373fe317c1373a9645065881c", - "reference": "71eb32534aba05e373fe317c1373a9645065881c", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/3f68a8b8f825974bc0318b8f7268a09216d5fee1", + "reference": "3f68a8b8f825974bc0318b8f7268a09216d5fee1", "shasum": "" }, "require": { @@ -2207,9 +2207,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.258.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.259.0" }, - "time": "2022-07-18T01:10:11+00:00" + "time": "2022-07-24T01:26:12+00:00" }, { "name": "google/auth", @@ -3478,16 +3478,16 @@ }, { "name": "laravel/framework", - "version": "v9.21.3", + "version": "v9.22.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "66bfa61e61ffceddb6370b57306c76ead7667622" + "reference": "b3b3dd43b9899f23df6d1d3e5390bd4662947a46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/66bfa61e61ffceddb6370b57306c76ead7667622", - "reference": "66bfa61e61ffceddb6370b57306c76ead7667622", + "url": "https://api.github.com/repos/laravel/framework/zipball/b3b3dd43b9899f23df6d1d3e5390bd4662947a46", + "reference": "b3b3dd43b9899f23df6d1d3e5390bd4662947a46", "shasum": "" }, "require": { @@ -3654,7 +3654,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-07-20T18:00:32+00:00" + "time": "2022-07-26T16:16:33+00:00" }, { "name": "laravel/serializable-closure", @@ -3778,28 +3778,28 @@ }, { "name": "laravel/socialite", - "version": "v5.5.2", + "version": "v5.5.3", "source": { "type": "git", "url": "https://github.com/laravel/socialite.git", - "reference": "68afb03259b82d898c68196cbcacd48596a9dd72" + "reference": "9dfc76b31ee041c45a7cae86f23339784abde46d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/socialite/zipball/68afb03259b82d898c68196cbcacd48596a9dd72", - "reference": "68afb03259b82d898c68196cbcacd48596a9dd72", + "url": "https://api.github.com/repos/laravel/socialite/zipball/9dfc76b31ee041c45a7cae86f23339784abde46d", + "reference": "9dfc76b31ee041c45a7cae86f23339784abde46d", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/guzzle": "^6.0|^7.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0", "illuminate/http": "^6.0|^7.0|^8.0|^9.0", "illuminate/support": "^6.0|^7.0|^8.0|^9.0", - "league/oauth1-client": "^1.0", + "league/oauth1-client": "^1.10.1", "php": "^7.2|^8.0" }, "require-dev": { - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0", "mockery/mockery": "^1.0", "orchestra/testbench": "^4.0|^5.0|^6.0|^7.0", "phpunit/phpunit": "^8.0|^9.3" @@ -3843,7 +3843,7 @@ "issues": "https://github.com/laravel/socialite/issues", "source": "https://github.com/laravel/socialite" }, - "time": "2022-03-10T15:26:19+00:00" + "time": "2022-07-18T13:51:19+00:00" }, { "name": "laravel/tinker", @@ -4383,16 +4383,16 @@ }, { "name": "league/flysystem", - "version": "3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "1a941703dfb649f9b821e7bc425e782f576a805e" + "reference": "ed0ecc7f9b5c2f4a9872185846974a808a3b052a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1a941703dfb649f9b821e7bc425e782f576a805e", - "reference": "1a941703dfb649f9b821e7bc425e782f576a805e", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/ed0ecc7f9b5c2f4a9872185846974a808a3b052a", + "reference": "ed0ecc7f9b5c2f4a9872185846974a808a3b052a", "shasum": "" }, "require": { @@ -4453,7 +4453,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.1.1" + "source": "https://github.com/thephpleague/flysystem/tree/3.2.0" }, "funding": [ { @@ -4469,20 +4469,20 @@ "type": "tidelift" } ], - "time": "2022-07-18T09:59:40+00:00" + "time": "2022-07-26T07:26:36+00:00" }, { "name": "league/flysystem-aws-s3-v3", - "version": "3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b" + "reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b", - "reference": "fa46ce9fbad9bfc73d8b160ffeb2c1793fe9c73b", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/257893ef7398b3c9255b26dff8b0118bb93fc5ff", + "reference": "257893ef7398b3c9255b26dff8b0118bb93fc5ff", "shasum": "" }, "require": { @@ -4523,7 +4523,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues", - "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.1.1" + "source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.2.0" }, "funding": [ { @@ -4539,7 +4539,7 @@ "type": "tidelift" } ], - "time": "2022-07-18T09:31:34+00:00" + "time": "2022-07-26T07:22:40+00:00" }, { "name": "league/fractal", @@ -5110,16 +5110,16 @@ }, { "name": "monolog/monolog", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524" + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524", - "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/720488632c590286b88b80e62aa3d3d551ad4a50", + "reference": "720488632c590286b88b80e62aa3d3d551ad4a50", "shasum": "" }, "require": { @@ -5139,11 +5139,10 @@ "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.15", "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1", + "predis/predis": "^1.1 || ^2.0", "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", "swiftmailer/swiftmailer": "^5.3|^6.0", @@ -5163,7 +5162,6 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, @@ -5198,7 +5196,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.7.0" + "source": "https://github.com/Seldaek/monolog/tree/2.8.0" }, "funding": [ { @@ -5210,7 +5208,7 @@ "type": "tidelift" } ], - "time": "2022-06-09T08:59:12+00:00" + "time": "2022-07-24T11:55:47+00:00" }, { "name": "mtdowling/jmespath.php", @@ -7801,16 +7799,16 @@ }, { "name": "rmccue/requests", - "version": "v2.0.3", + "version": "v2.0.4", "source": { "type": "git", "url": "https://github.com/WordPress/Requests.git", - "reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff" + "reference": "62bf29e0f1080b4f0f499d30adb6a382e70e9686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/Requests/zipball/b290dd974051bf1ead51d1947a5a56357e5b80ff", - "reference": "b290dd974051bf1ead51d1947a5a56357e5b80ff", + "url": "https://api.github.com/repos/WordPress/Requests/zipball/62bf29e0f1080b4f0f499d30adb6a382e70e9686", + "reference": "62bf29e0f1080b4f0f499d30adb6a382e70e9686", "shasum": "" }, "require": { @@ -7878,7 +7876,7 @@ "issues": "https://github.com/WordPress/Requests/issues", "source": "https://github.com/WordPress/Requests" }, - "time": "2022-05-10T08:42:27+00:00" + "time": "2022-07-25T09:01:09+00:00" }, { "name": "sabre/uri", @@ -12757,16 +12755,16 @@ }, { "name": "brianium/paratest", - "version": "v6.6.0", + "version": "v6.6.1", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "bce7b965a5fe5028a53c3151042ca12777600acd" + "reference": "ae5803ce4558f855c7d955baa2d90b93ec40c4b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/bce7b965a5fe5028a53c3151042ca12777600acd", - "reference": "bce7b965a5fe5028a53c3151042ca12777600acd", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/ae5803ce4558f855c7d955baa2d90b93ec40c4b7", + "reference": "ae5803ce4558f855c7d955baa2d90b93ec40c4b7", "shasum": "" }, "require": { @@ -12833,7 +12831,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.6.0" + "source": "https://github.com/paratestphp/paratest/tree/v6.6.1" }, "funding": [ { @@ -12845,7 +12843,7 @@ "type": "paypal" } ], - "time": "2022-07-12T07:15:58+00:00" + "time": "2022-07-22T14:07:17+00:00" }, { "name": "composer/package-versions-deprecated", @@ -13675,16 +13673,16 @@ }, { "name": "laravel/dusk", - "version": "v6.25.0", + "version": "v6.25.1", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "b4632b7493a187d31afc5c9ddec437c81b16421a" + "reference": "cd93e41d610965842e4b61f4691a0a0889737790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/b4632b7493a187d31afc5c9ddec437c81b16421a", - "reference": "b4632b7493a187d31afc5c9ddec437c81b16421a", + "url": "https://api.github.com/repos/laravel/dusk/zipball/cd93e41d610965842e4b61f4691a0a0889737790", + "reference": "cd93e41d610965842e4b61f4691a0a0889737790", "shasum": "" }, "require": { @@ -13742,9 +13740,9 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v6.25.0" + "source": "https://github.com/laravel/dusk/tree/v6.25.1" }, - "time": "2022-07-11T11:38:43+00:00" + "time": "2022-07-25T13:51:51+00:00" }, { "name": "maximebf/debugbar", @@ -16652,5 +16650,5 @@ "platform-dev": { "php": "^7.4|^8.0" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } diff --git a/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php b/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php new file mode 100644 index 000000000000..168f18da29d7 --- /dev/null +++ b/database/migrations/2022_07_26_091216_add_sms_verification_to_hosted_account.php @@ -0,0 +1,34 @@ +text('account_sms_verification_code')->nullable(); + $table->text('account_sms_verification_number')->nullable(); + $table->boolean('account_sms_verified')->default(0); + }); + + App\Models\Account::query()->update(['account_sms_verified' => true]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + } +} diff --git a/routes/api.php b/routes/api.php index e6017b3e6e7a..8edbb699e0e4 100644 --- a/routes/api.php +++ b/routes/api.php @@ -86,6 +86,7 @@ use App\Http\Controllers\TaskStatusController; use App\Http\Controllers\TaxRateController; use App\Http\Controllers\TemplateController; use App\Http\Controllers\TokenController; +use App\Http\Controllers\TwilioController; use App\Http\Controllers\TwoFactorController; use App\Http\Controllers\UserController; use App\Http\Controllers\VendorController; @@ -285,6 +286,10 @@ Route::group(['middleware' => ['throttle:100,1', 'api_db', 'token_auth', 'locale Route::post('settings/enable_two_factor', [TwoFactorController::class, 'enableTwoFactor']); Route::post('settings/disable_two_factor', [TwoFactorController::class, 'disableTwoFactor']); + + Route::post('verify', [TwilioController::class, 'generate'])->name('verify.generate'); + Route::post('verify/confirm', [TwilioController::class, 'confirm'])->name('verify.confirm'); + Route::resource('vendors', VendorController::class); // name = (vendors. index / create / show / update / destroy / edit Route::post('vendors/bulk', [VendorController::class, 'bulk'])->name('vendors.bulk'); Route::put('vendors/{vendor}/upload', [VendorController::class, 'upload']);