mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 19:59:18 -08:00
Check for demo mode in the clear method for the controller
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a14d1b981d
commit
647f47cdfe
|
@ -1155,10 +1155,10 @@ class Helper
|
|||
* This makes it cleanly available in blades and in controllers, e.g.
|
||||
*
|
||||
* Blade:
|
||||
* {{ app('demo_mode') ? ' disabled' : ''}} for form blades where we need to disable a form
|
||||
* {{ Helper::isDemoMode() ? ' disabled' : ''}} for form blades where we need to disable a form
|
||||
*
|
||||
* Controller:
|
||||
* if (app('demo_mode')) {
|
||||
* if (Helper::isDemoMode()) {
|
||||
* // don't allow the thing
|
||||
* }
|
||||
* @todo - use this everywhere else in the app where we have very long if/else config('app.lock_passwords') stuff
|
||||
|
|
|
@ -131,21 +131,25 @@ class SlackSettingsForm extends Component
|
|||
}
|
||||
|
||||
public function clearSettings(){
|
||||
$this->webhook_endpoint = '';
|
||||
$this->webhook_channel = '';
|
||||
$this->webhook_botname = '';
|
||||
$this->setting->webhook_endpoint = '';
|
||||
$this->setting->webhook_channel = '';
|
||||
$this->setting->webhook_botname = '';
|
||||
if (Helper::isDemoMode()) {
|
||||
session()->flash('error',trans('general.feature_disabled'));
|
||||
} else {
|
||||
$this->webhook_endpoint = '';
|
||||
$this->webhook_channel = '';
|
||||
$this->webhook_botname = '';
|
||||
$this->setting->webhook_endpoint = '';
|
||||
$this->setting->webhook_channel = '';
|
||||
$this->setting->webhook_botname = '';
|
||||
|
||||
$this->setting->save();
|
||||
$this->setting->save();
|
||||
|
||||
session()->flash('success',trans('admin/settings/message.update.success'));
|
||||
session()->flash('success', trans('admin/settings/message.update.success'));
|
||||
}
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
if (app('demo_mode')) {
|
||||
if (Helper::isDemoMode()) {
|
||||
session()->flash('error',trans('general.feature_disabled'));
|
||||
} else {
|
||||
if ($this->webhook_selected != 'general') {
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<div class="box-footer">
|
||||
<div class="text-right col-md-12">
|
||||
|
||||
<button type="reset" wire:click.prevent="clearSettings" class="col-md-2 text-left btn btn-danger pull-left">{{ trans('general.clear_and_save') }}</button>
|
||||
<button type="reset" wire:click.prevent="clearSettings" class="col-md-2 text-left btn btn-danger pull-left"{{ Helper::isDemoMode() ? ' disabled' : ''}}>{{ trans('general.clear_and_save') }}</button>
|
||||
|
||||
<a class="btn btn-link pull-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||
|
||||
|
|
Loading…
Reference in a new issue