diff --git a/CHANGELOG.md b/CHANGELOG.md index 068c25701..f27e23e6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/Http/Requests/Admin/DatabaseHostFormRequest.php b/app/Http/Requests/Admin/DatabaseHostFormRequest.php index ae46f7c76..a7b0b4aff 100644 --- a/app/Http/Requests/Admin/DatabaseHostFormRequest.php +++ b/app/Http/Requests/Admin/DatabaseHostFormRequest.php @@ -1,11 +1,4 @@ . - * - * 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(); + } }