forked from Alex/Pterodactyl-Panel
Fix FQDN failing validation in database host UI, ref #957
This commit is contained in:
parent
c61c2bc5fd
commit
3fb02a4b3c
@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
### Fixed
|
||||
* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.
|
||||
* Fixes an exception when trying to perform actions aganist a User model due to a validator that could not be cast to a string correctly.
|
||||
* Allow FQDNs in database host creation UI correctly.
|
||||
|
||||
## v0.7.0 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
|
@ -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…
Reference in New Issue
Block a user