mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
adds better error messaging
This commit is contained in:
parent
b7901ae2d8
commit
c21586dee5
|
@ -26,10 +26,13 @@ class SlackSettingsForm extends Component
|
|||
|
||||
|
||||
protected $rules = [
|
||||
'webhook_endpoint' => 'url|required_with:webhook_channel|starts_with:http://,https://,ftp://,irc://,https://hooks.slack.com/services/|nullable',
|
||||
'webhook_endpoint' => 'required_with:webhook_channel|starts_with:http://,https://,ftp://,irc://,https://hooks.slack.com/services/|url|nullable',
|
||||
'webhook_channel' => 'required_with:webhook_endpoint|starts_with:#|nullable',
|
||||
'webhook_botname' => 'string|nullable',
|
||||
];
|
||||
public $messages = [
|
||||
'webhook_endpoint.starts_with' => 'your webhook endpoint should begin with http://, https:// or other protocol.',
|
||||
];
|
||||
|
||||
public function mount() {
|
||||
$this->webhook_text= [
|
||||
|
@ -120,8 +123,8 @@ class SlackSettingsForm extends Component
|
|||
try {
|
||||
$test = $webhook->post($this->webhook_endpoint, ['body' => $payload]);
|
||||
|
||||
if($test->getStatusCode() == 302){
|
||||
return session()->flash('error' , 'This endpoint returns a redirect. For security reasons, we don’t follow redirects. Please use the actual endpoint');
|
||||
if(($test->getStatusCode() == 302)||($test->getStatusCode() == 301)){
|
||||
return session()->flash('error' , 'ERROR: 301/302 '.$this->webhook_endpoint.' returns a redirect. For security reasons, we don’t follow redirects. Please use the actual endpoint.');
|
||||
}
|
||||
$this->isDisabled='';
|
||||
$this->save_button = trans('general.save');
|
||||
|
|
3468
composer.lock
generated
3468
composer.lock
generated
File diff suppressed because it is too large
Load diff
4
public/vendor/livewire/livewire.js
vendored
4
public/vendor/livewire/livewire.js
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/livewire/livewire.js.map
vendored
2
public/vendor/livewire/livewire.js.map
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/livewire/manifest.json
vendored
2
public/vendor/livewire/manifest.json
vendored
|
@ -1 +1 @@
|
|||
{"/livewire.js":"/livewire.js?id=c69d0f2801c01fcf8166"}
|
||||
{"/livewire.js":"/livewire.js?id=90730a3b0e7144480175"}
|
Loading…
Reference in a new issue