Merge pull request #1188 from openclassify/vedat

fix auth
This commit is contained in:
profstyle1 2021-10-06 10:05:29 +03:00 committed by GitHub
commit 40d9214926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 14 deletions

View File

@ -114,10 +114,12 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
], ],
'advs/create_adv' => [ 'advs/create_adv' => [
'as' => "advs::create_adv", 'as' => "advs::create_adv",
'middleware' => 'auth',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@cats', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@cats',
], ],
'advs/create_adv/post_cat' => [ 'advs/create_adv/post_cat' => [
'as' => 'post_adv', 'as' => 'post_adv',
'middleware' => 'auth',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@create', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@create',
], ],
'advs/save_adv' => [ 'advs/save_adv' => [
@ -135,6 +137,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
], ],
'advs/delete/{id}' => [ 'advs/delete/{id}' => [
'as' => 'advs::delete', 'as' => 'advs::delete',
'middleware' => 'auth',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@deleteAd', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\AdvsController@deleteAd',
], ],
'adv/addCart/{id}' => [ 'adv/addCart/{id}' => [
@ -205,6 +208,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
//Configurations Admin Controller //Configurations Admin Controller
'admin/advs/option_configuration/create' => [ 'admin/advs/option_configuration/create' => [
'middleware' => 'auth',
'as' => 'visiosoft.module.advs::configrations.create', 'as' => 'visiosoft.module.advs::configrations.create',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\Admin\OptionConfigurationController@create',
], ],
@ -215,6 +219,7 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
//Configuration Controller //Configuration Controller
'advs/option_configuration/create' => [ 'advs/option_configuration/create' => [
'middleware' => 'auth',
'as' => 'visiosoft.module.advs::user.configrations.create', 'as' => 'visiosoft.module.advs::user.configrations.create',
'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create', 'uses' => 'Visiosoft\AdvsModule\Http\Controller\OptionConfigurationController@create',
], ],

View File

@ -711,7 +711,6 @@ class AdvsController extends PublicController
public function deleteAd(AdvRepositoryInterface $advs, $id) public function deleteAd(AdvRepositoryInterface $advs, $id)
{ {
$ad = $this->adv_model->find($id); $ad = $this->adv_model->find($id);
$this->middleware('auth');
if ($ad->created_by_id != Auth::id()) { if ($ad->created_by_id != Auth::id()) {
$this->messages->error(trans('visiosoft.module.advs::message.delete_author_error')); $this->messages->error(trans('visiosoft.module.advs::message.delete_author_error'));
@ -743,8 +742,6 @@ class AdvsController extends PublicController
public function create(AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository) public function create(AdvFormBuilder $formBuilder, CategoryRepositoryInterface $repository)
{ {
$this->middleware('auth');
$isActive = new AdvModel(); $isActive = new AdvModel();
$cats = $this->request->toArray(); $cats = $this->request->toArray();
unset($cats['_token']); unset($cats['_token']);
@ -1059,7 +1056,6 @@ class AdvsController extends PublicController
public function cats() public function cats()
{ {
$this->middleware('auth');
$main_cats = $this->category_repository->getMainCategories(); $main_cats = $this->category_repository->getMainCategories();
return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('main_cats')); return $this->view->make('visiosoft.module.advs::new-ad/post-cat', compact('main_cats'));

View File

@ -34,7 +34,7 @@ class MyProfileController extends PublicController
) )
{ {
parent::__construct(); parent::__construct();
$this->middleware('auth');
$this->adressRepository = $adressRepository; $this->adressRepository = $adressRepository;
$this->userRepository = $userRepository; $this->userRepository = $userRepository;
} }

View File

@ -46,44 +46,72 @@ class ProfileModuleServiceProvider extends AddonServiceProvider
// MyProfileController // MyProfileController
'profile/ads' => [ 'profile/ads' => [
'as' => 'profile::ads', 'as' => 'profile::ads',
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@myAds' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@myAds'
], ],
'profile/adress/ajaxCreate' => [ 'profile/adress/ajaxCreate' => [
'as' => 'visiosoft.module.profile::adress_ajax_create', 'as' => 'visiosoft.module.profile::adress_ajax_create',
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxCreate' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxCreate'
], ],
'profile/adress/ajaxUpdate/{id}' => [ 'profile/adress/ajaxUpdate/{id}' => [
'as' => 'visiosoft.module.profile::adress_ajax_update', 'as' => 'visiosoft.module.profile::adress_ajax_update',
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxUpdate' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxUpdate'
], ],
'profile/adress/ajaxDetail' => [ 'profile/adress/ajaxDetail' => [
'as' => 'visiosoft.module.profile::adress_ajax_detail', 'as' => 'visiosoft.module.profile::adress_ajax_detail',
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxDetail' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@adressAjaxDetail'
], ],
'profile' => [ 'profile' => [
'as' => 'profile::profile', 'as' => 'profile::profile',
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@home' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@home'
], ],
'profile/detail' => [ 'profile/detail' => [
'as' => 'profile::detail', 'as' => 'profile::detail',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@detail' 'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@detail'
], ],
'profile/password' => [ 'profile/password' => [
'as' => 'profile::password', 'as' => 'profile::password',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@password' 'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@password'
], ],
'profile/class/status/{id},{type}' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@statusAds', 'profile/class/status/{id},{type}' => [
'profile/class/extendTime/{id},{type}' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@extendAds', 'middleware' => 'auth',
'profile/message/show/{id}' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@showMessage', 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@statusAds',
],
'profile/class/extendTime/{id},{type}' => [
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@extendAds',
],
'profile/message/show/{id}' => [
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@showMessage',
],
'profile/close-account' => [ 'profile/close-account' => [
'middleware' => 'auth', 'middleware' => 'auth',
'as' => 'visiosoft.module.profile::profile_close_account', 'as' => 'visiosoft.module.profile::profile_close_account',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@disableAccount' 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@disableAccount'
], ],
'profile/notification' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification', 'profile/notification' => [
'ajax/update-user-info' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@updateAjaxProfile', 'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@notification',
'api/changeEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@changeEducation', 'middleware' => 'auth',
'api/getEducation' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation', ],
'ajax/update-user-info' => [
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@updateAjaxProfile',
],
'api/changeEducation' => [
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@changeEducation',
],
'api/getEducation' => [
'middleware' => 'auth',
'uses' => 'Visiosoft\ProfileModule\Http\Controller\MyProfileController@getEducation',
],
// UserAuthenticator // UserAuthenticator
'login-in' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@attempt', 'login-in' => 'Visiosoft\ProfileModule\Http\Controller\UserAuthenticator@attempt',