Skip to content

Commit 3fb02a4

Browse files
committed
Fix FQDN failing validation in database host UI, ref pterodactyl#957
1 parent c61c2bc commit 3fb02a4

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
77
### Fixed
88
* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.
99
* 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.
10+
* Allow FQDNs in database host creation UI correctly.
1011

1112
## v0.7.0 (Derelict Dermodactylus)
1213
### Fixed
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Pterodactyl\Http\Requests\Admin;
114

@@ -18,14 +11,28 @@ class DatabaseHostFormRequest extends AdminFormRequest
1811
*/
1912
public function rules()
2013
{
21-
if (! $this->filled('node_id')) {
22-
$this->merge(['node_id' => null]);
23-
}
24-
2514
if ($this->method() !== 'POST') {
2615
return DatabaseHost::getUpdateRulesForId($this->route()->parameter('host'));
2716
}
2817

2918
return DatabaseHost::getCreateRules();
3019
}
20+
21+
/**
22+
* Modify submitted data before it is passed off to the validator.
23+
*
24+
* @return \Illuminate\Contracts\Validation\Validator
25+
*/
26+
protected function getValidatorInstance()
27+
{
28+
if (! $this->filled('node_id')) {
29+
$this->merge(['node_id' => null]);
30+
}
31+
32+
$this->merge([
33+
'host' => gethostbyname($this->input('host')),
34+
]);
35+
36+
return parent::getValidatorInstance();
37+
}
3138
}

0 commit comments

Comments
 (0)