Skip to content

Commit

Permalink
Fix CSP error on module install - closes #3445
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Oct 8, 2023
1 parent d9dac04 commit 76b3776
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4916,6 +4916,12 @@ function initModulesList()
}, true
);
});

$('.install-module-form').submit(function(e) {
installModule($(this).attr('data-module-alias'));
e.preventDefault();
return false;
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/modules/partials/module_card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@elseif (!empty($module['activated']))
<button type="submit" class="btn btn-primary activate-trigger" data-loading-text="{{ __('Activating') }}">{{ __('Activate') }}</button>
@else
<form action="javascript:installModule('{{ $module['alias'] }}');">
<form action="" class="install-module-form" data-module-alias="{{ $module['alias'] }}">
<div class="input-group">
<input type="text" class="form-control license-key" placeholder="{{ __('License Key') }}" value="{{ App\Module::getLicense($module['alias']) }}" required="required">
<span class="input-group-btn">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/vendor/translation-manager/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ class="glyphicon glyphicon-trash"></span></a>
&nbsp;&nbsp;
<button type="submit" class="btn btn-primary" data-disable-with="Sending…" >Publish and Send to <?php echo \Config::get('app.name') ?> Team</button>
</form>
<form class="form-inline form-download pull-left" method="POST" target="_blank" action="<?php echo action('TranslateController@postDownload') ?>" onsubmit="javascript:confirm('This will publish translations and download them as ZIP archive.');">
<form class="form-inline form-download pull-left" method="POST" target="_blank" action="<?php echo action('TranslateController@postDownload') ?>">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">

<button type="submit" class="btn btn-link" data-disable-with="Preparing…" title="Download translations as ZIP archive">Download as ZIP</button>
<button type="submit" class="btn btn-link form-download-trigger" data-disable-with="Preparing…" title="Download translations as ZIP archive">Download as ZIP</button>
</form>
<form class="form-inline form-remove-unpublished pull-left" method="POST" action="<?php echo action('TranslateController@postRemoveUnpublished') ?>" data-remote="true" role="form" data-confirm="Are you sure you want to remove all translations which has not been published yet?">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
Expand Down
7 changes: 7 additions & 0 deletions resources/views/vendor/translation-manager/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,12 @@
$('div.success-remove-unpublished').slideDown();
});

$('.form-download-trigger').click(function(e) {
if (confirm('This will publish translations and download them as ZIP archive.')) {
return true;
} else {
e.preventDefault();
}
});
})
@endsection

0 comments on commit 76b3776

Please sign in to comment.