register ajax cors added

This commit is contained in:
vedatakd 2019-07-16 16:45:16 +03:00
parent 0ba787a7ea
commit f4996973aa
4 changed files with 78 additions and 19 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace Visiosoft\ProfileModule\Http\Middleware;
class Cors
{
public function handle()
{
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS
|--------------------------------------------------------------------------
|
| allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
| to accept any value.
|
*/
'supportsCredentials' => false,
'allowedOrigins' => ['*'],// ex: ['abc.com', 'api.abc.com']
'allowedHeaders' => ['*'],
'allowedMethods' => ['*'],// ex: ['GET', 'POST', 'PUT', 'DELETE']
'exposedHeaders' => [],
'maxAge' => 0,
];
}
}

View File

@ -5,6 +5,7 @@ use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
use Visiosoft\ProfileModule\Adress\AdressRepository; use Visiosoft\ProfileModule\Adress\AdressRepository;
use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel; use Anomaly\Streams\Platform\Model\Profile\ProfileAdressEntryModel;
use Visiosoft\ProfileModule\Adress\AdressModel; use Visiosoft\ProfileModule\Adress\AdressModel;
use Visiosoft\ProfileModule\Http\Middleware\Cors;
use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface; use Visiosoft\ProfileModule\Profile\Contract\ProfileRepositoryInterface;
use Visiosoft\ProfileModule\Profile\ProfileRepository; use Visiosoft\ProfileModule\Profile\ProfileRepository;
use Anomaly\Streams\Platform\Model\Profile\ProfileProfileEntryModel; use Anomaly\Streams\Platform\Model\Profile\ProfileProfileEntryModel;
@ -42,7 +43,8 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
* *
* @type array|null * @type array|null
*/ */
protected $api = []; protected $api = [
];
/** /**
* The addon routes. * The addon routes.
@ -95,7 +97,16 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
'profile/notification' => [ 'profile/notification' => [
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification', 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification',
], ],
'register/ajax' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@registerAjax',
'register/ajax' =>[
'uses' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@registerAjax',
'middleware' => [
\Barryvdh\Cors\HandleCors::class,
],
],
]; ];
@ -124,7 +135,9 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
* *
* @type array|null * @type array|null
*/ */
protected $routeMiddleware = []; protected $routeMiddleware = [
'cors' => Cors::class,
];
/** /**
* The addon event listeners. * The addon event listeners.

View File

@ -17,7 +17,7 @@
"require": { "require": {
"wikimedia/composer-merge-plugin": "~1.4.0", "wikimedia/composer-merge-plugin": "~1.4.0",
"anomaly/streams-composer-plugin": "~1.1.0", "anomaly/streams-composer-plugin": "~1.1.0",
"anomaly/streams-platform": "~1.5.0", "anomaly/streams-platform": "~1.6.0",
"anomaly/default_authenticator-extension": "~2.1.0", "anomaly/default_authenticator-extension": "~2.1.0",
"anomaly/throttle_security_check-extension": "~2.1.0", "anomaly/throttle_security_check-extension": "~2.1.0",
"anomaly/local_storage_adapter-extension": "~2.1.0", "anomaly/local_storage_adapter-extension": "~2.1.0",
@ -26,12 +26,13 @@
"anomaly/xml_feed_widget-extension": "~2.1.0", "anomaly/xml_feed_widget-extension": "~2.1.0",
"anomaly/page_link_type-extension": "~2.1.0", "anomaly/page_link_type-extension": "~2.1.0",
"anomaly/url_link_type-extension": "~2.1.0", "anomaly/url_link_type-extension": "~2.1.0",
"anomaly/encrypted-field_type": "~2.1.0",
"anomaly/relationship-field_type": "~2.2.0", "anomaly/relationship-field_type": "~2.2.0",
"anomaly/polymorphic-field_type": "~2.1.0", "anomaly/polymorphic-field_type": "~2.1.0",
"anomaly/checkboxes-field_type": "~2.4.0", "anomaly/checkboxes-field_type": "~2.4.0",
"anomaly/datetime-field_type": "~3.0.0", "anomaly/datetime-field_type": "~3.0.0",
"anomaly/language-field_type": "~2.2.0", "anomaly/language-field_type": "~2.2.0",
"anomaly/multiple-field_type": "~2.2.0", "anomaly/multiple-field_type": "~2.3.0",
"anomaly/textarea-field_type": "~2.1.0", "anomaly/textarea-field_type": "~2.1.0",
"anomaly/wysiwyg-field_type": "~3.1.0", "anomaly/wysiwyg-field_type": "~3.1.0",
"anomaly/boolean-field_type": "~2.3.0", "anomaly/boolean-field_type": "~2.3.0",
@ -41,33 +42,40 @@
"anomaly/select-field_type": "~2.3.0", "anomaly/select-field_type": "~2.3.0",
"anomaly/addon-field_type": "~2.2.0", "anomaly/addon-field_type": "~2.2.0",
"anomaly/email-field_type": "~2.1.0", "anomaly/email-field_type": "~2.1.0",
"anomaly/files-field_type": "~2.2.0", "anomaly/state-field_type": "~2.3.0",
"anomaly/tags-field_type": "~2.3.0", "anomaly/files-field_type": "~2.3.0",
"anomaly/tags-field_type": "~2.4.0",
"anomaly/slug-field_type": "~2.1.0", "anomaly/slug-field_type": "~2.1.0",
"anomaly/text-field_type": "~2.2.0", "anomaly/text-field_type": "~2.2.0",
"anomaly/file-field_type": "~2.2.0", "anomaly/file-field_type": "~2.2.0",
"anomaly/url-field_type": "~2.2.0", "anomaly/url-field_type": "~2.2.0",
"anomaly/configuration-module": "~2.1.0", "anomaly/configuration-module": "~2.1.0",
"anomaly/preferences-module": "~2.1.0", "anomaly/preferences-module": "~2.2.0",
"anomaly/navigation-module": "~2.4.0", "anomaly/navigation-module": "~2.4.0",
"anomaly/dashboard-module": "~2.2.0", "anomaly/dashboard-module": "~2.2.0",
"anomaly/redirects-module": "~2.2.0", "anomaly/redirects-module": "~2.3.0",
"anomaly/variables-module": "~2.3.0", "anomaly/variables-module": "~2.4.0",
"anomaly/settings-module": "~2.3.0", "anomaly/settings-module": "~2.4.0",
"anomaly/addons-module": "~2.2.0", "anomaly/addons-module": "~2.3.0",
"anomaly/blocks-module": "~1.2.0", "anomaly/blocks-module": "~1.3.0",
"anomaly/users-module": "~2.4.0", "anomaly/system-module": "~1.0.0",
"anomaly/pages-module": "~2.5.0", "anomaly/users-module": "~2.5.0",
"anomaly/posts-module": "~2.5.0", "anomaly/pages-module": "~2.6.0",
"anomaly/files-module": "~2.5.0", "anomaly/posts-module": "~2.6.0",
"anomaly/files-module": "~2.6.0",
"anomaly/contact-plugin": "~1.2.0", "anomaly/contact-plugin": "~1.2.0",
"anomaly/helper-plugin": "~2.1.0", "anomaly/helper-plugin": "~2.1.0",
"anomaly/robots-extension": "~2.1.0", "anomaly/robots-extension": "~2.1.0",
"anomaly/sitemap-extension": "~2.1.0", "anomaly/sitemap-extension": "~2.2.0",
"anomaly/html_block-extension": "~1.0.0", "anomaly/html_block-extension": "~1.0.0",
"anomaly/wysiwyg_block-extension": "~1.0.0", "anomaly/wysiwyg_block-extension": "~1.0.0",
"guzzlehttp/guzzle": "~6.3.3",
"ammadeuss/laravel-html-dom-parser": "^1.1", "ammadeuss/laravel-html-dom-parser": "^1.1",
"guzzlehttp/guzzle": "~6.3.3" "visiosoft/subscriptions-module": "^1.0",
"visiosoft/orders-module": "^1.0",
"visiosoft/notifications-module": "^1.0",
"visiosoft/site_method_jenkins-module": "^1.0",
"barryvdh/laravel-cors": "^0.11.3"
}, },
"require-dev": { "require-dev": {
"filp/whoops": "~2.0", "filp/whoops": "~2.0",
@ -114,6 +122,11 @@
], ],
"recurse": true, "recurse": true,
"replace": false "replace": false
},
"laravel": {
"dont-discover": [
"*"
]
} }
}, },
"config": { "config": {

View File

@ -178,6 +178,7 @@ return [
Illuminate\Encryption\EncryptionServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class, Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class, Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Barryvdh\Cors\ServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class, Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class, Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class,