diff --git a/CHANGELOG.md b/CHANGELOG.md index f27e23e6f..2dcd758a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * 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. +* Fixes database naming scheme using `d###_` rather than `s###_` when creating server databases. +* Fix exception thrown when attempting to update an existing database host. ## v0.7.0 (Derelict Dermodactylus) ### Fixed diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 38bc5b701..d03f7050e 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -11,6 +11,7 @@ namespace Pterodactyl\Http\Controllers\Admin; use PDOException; use Illuminate\View\View; +use Pterodactyl\Models\DatabaseHost; use Illuminate\Http\RedirectResponse; use Prologue\Alerts\AlertsMessageBag; use Pterodactyl\Http\Controllers\Controller; @@ -136,22 +137,25 @@ class DatabaseController extends Controller * Handle updating database host. * * @param \Pterodactyl\Http\Requests\Admin\DatabaseHostFormRequest $request - * @param int $host + * @param \Pterodactyl\Models\DatabaseHost $host * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ - public function update(DatabaseHostFormRequest $request, int $host): RedirectResponse + public function update(DatabaseHostFormRequest $request, DatabaseHost $host): RedirectResponse { + $redirect = redirect()->route('admin.databases.view', $host->id); + try { - $host = $this->updateService->handle($host, $request->normalize()); + $this->updateService->handle($host->id, $request->normalize()); $this->alert->success('Database host was updated successfully.')->flash(); } catch (PDOException $ex) { $this->alert->danger($ex->getMessage())->flash(); + $redirect->withInput($request->normalize()); } - return redirect()->route('admin.databases.view', $host->id); + return $redirect; } /** diff --git a/resources/themes/pterodactyl/admin/databases/view.blade.php b/resources/themes/pterodactyl/admin/databases/view.blade.php index 427fafb82..db7db1c48 100644 --- a/resources/themes/pterodactyl/admin/databases/view.blade.php +++ b/resources/themes/pterodactyl/admin/databases/view.blade.php @@ -29,16 +29,16 @@
The IP address or FQDN that should be used when attempting to connect to this MySQL host from the panel to add new databases.
The port that MySQL is running on for this host.
The username of an account that has enough permissions to create new users and databases on the system.