Skip to content

Commit

Permalink
Switch GET to POST for asset request
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <snipe@snipe.net>
  • Loading branch information
snipe committed Dec 17, 2021
1 parent a05fe9c commit 9b2dd65
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/ViewAssetsController.php
Expand Up @@ -179,7 +179,7 @@ public function getRequestAsset($assetId = null)
$logaction->logaction('request canceled');
$settings->notify(new RequestAssetCancelation($data));
return redirect()->route('requestable-assets')
->with('success')->with('success', trans('admin/hardware/message.requests.cancel-success'));
->with('success')->with('success', trans('admin/hardware/message.requests.cancel'));
}

$logaction->logaction('requested');
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/admin/hardware/message.php
Expand Up @@ -77,7 +77,7 @@
'requests' => array(
'error' => 'Asset was not requested, please try again',
'success' => 'Asset requested successfully.',
'canceled' => 'Checkout request successfully canceled'
'cancel' => 'Checkout request successfully canceled'
)

);
4 changes: 2 additions & 2 deletions resources/views/partials/bootstrap-table.blade.php
Expand Up @@ -365,9 +365,9 @@ function genericCheckinCheckoutFormatter(destination) {
// This is only used by the requestable assets section
function assetRequestActionsFormatter (row, value) {
if (value.available_actions.cancel == true) {
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="GET"><button class="btn btn-danger btn-sm" data-toggle="tooltip" title="Cancel this item request">{{ trans('button.cancel') }}</button></form>';
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="POST">@csrf<button class="btn btn-danger btn-sm" data-toggle="tooltip" title="Cancel this item request">{{ trans('button.cancel') }}</button></form>';
} else if (value.available_actions.request == true) {
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="GET"><button class="btn btn-primary btn-sm" data-toggle="tooltip" title="Request this item">{{ trans('button.request') }}</button></form>';
return '<form action="{{ url('/') }}/account/request-asset/'+ value.id + '" method="POST">@csrf<button class="btn btn-primary btn-sm" data-toggle="tooltip" title="Request this item">{{ trans('button.request') }}</button></form>';
}
}
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Expand Up @@ -261,7 +261,7 @@
'requestable-assets',
[ 'as' => 'requestable-assets', 'uses' => 'ViewAssetsController@getRequestableIndex' ]
);
Route::get(
Route::post(
'request-asset/{assetId}',
[ 'as' => 'account/request-asset', 'uses' => 'ViewAssetsController@getRequestAsset' ]
);
Expand Down

0 comments on commit 9b2dd65

Please sign in to comment.