Fix FQDN failing validation in database host UI, ref #957
This commit is contained in:
parent
c61c2bc5fd
commit
3fb02a4b3c
2 changed files with 19 additions and 11 deletions
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Admin;
|
||||
|
||||
|
@ -18,14 +11,28 @@ class DatabaseHostFormRequest extends AdminFormRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
if (! $this->filled('node_id')) {
|
||||
$this->merge(['node_id' => null]);
|
||||
}
|
||||
|
||||
if ($this->method() !== 'POST') {
|
||||
return DatabaseHost::getUpdateRulesForId($this->route()->parameter('host'));
|
||||
}
|
||||
|
||||
return DatabaseHost::getCreateRules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify submitted data before it is passed off to the validator.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function getValidatorInstance()
|
||||
{
|
||||
if (! $this->filled('node_id')) {
|
||||
$this->merge(['node_id' => null]);
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'host' => gethostbyname($this->input('host')),
|
||||
]);
|
||||
|
||||
return parent::getValidatorInstance();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue