mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -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.
|
* This makes it cleanly available in blades and in controllers, e.g.
|
||||||
*
|
*
|
||||||
* Blade:
|
* 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:
|
* Controller:
|
||||||
* if (app('demo_mode')) {
|
* if (Helper::isDemoMode()) {
|
||||||
* // don't allow the thing
|
* // 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
|
* @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(){
|
public function clearSettings(){
|
||||||
$this->webhook_endpoint = '';
|
if (Helper::isDemoMode()) {
|
||||||
$this->webhook_channel = '';
|
session()->flash('error',trans('general.feature_disabled'));
|
||||||
$this->webhook_botname = '';
|
} else {
|
||||||
$this->setting->webhook_endpoint = '';
|
$this->webhook_endpoint = '';
|
||||||
$this->setting->webhook_channel = '';
|
$this->webhook_channel = '';
|
||||||
$this->setting->webhook_botname = '';
|
$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()
|
public function submit()
|
||||||
{
|
{
|
||||||
if (app('demo_mode')) {
|
if (Helper::isDemoMode()) {
|
||||||
session()->flash('error',trans('general.feature_disabled'));
|
session()->flash('error',trans('general.feature_disabled'));
|
||||||
} else {
|
} else {
|
||||||
if ($this->webhook_selected != 'general') {
|
if ($this->webhook_selected != 'general') {
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<div class="text-right col-md-12">
|
<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>
|
<a class="btn btn-link pull-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue