Fix exception when adjusting mail settings, closes #907
This commit is contained in:
parent
48c933fa0f
commit
d9355b93b4
4 changed files with 14 additions and 12 deletions
|
@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
|||
### Fixed
|
||||
* `[rc.1]` — Fixes exception thrown when revoking user sessions.
|
||||
* `[rc.1]` — Fixes exception that would occur when trying to delete allocations from a node.
|
||||
* `[rc.1]` — Fixes exception thown when attempting to adjust mail settings as well as a validation error thrown afterwards.
|
||||
|
||||
## v0.7.0-rc.1 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
|
|
|
@ -7,13 +7,13 @@ interface SettingsRepositoryInterface extends RepositoryInterface
|
|||
/**
|
||||
* Store a new persistent setting in the database.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param string|null $value
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function set(string $key, string $value);
|
||||
public function set(string $key, string $value = null);
|
||||
|
||||
/**
|
||||
* Retrieve a persistent setting from the database.
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Http\Requests\Admin\Settings;
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
|
||||
|
||||
class MailSettingsFormRequest extends AdminFormRequest
|
||||
|
@ -16,11 +17,11 @@ class MailSettingsFormRequest extends AdminFormRequest
|
|||
return [
|
||||
'mail:host' => 'required|string',
|
||||
'mail:port' => 'required|integer|between:1,65535',
|
||||
'mail:encryption' => 'present|string|in:"",tls,ssl',
|
||||
'mail:username' => 'string|max:255',
|
||||
'mail:password' => 'string|max:255',
|
||||
'mail:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
|
||||
'mail:username' => 'nullable|string|max:255',
|
||||
'mail:password' => 'nullable|string|max:255',
|
||||
'mail:from:address' => 'required|string|email',
|
||||
'mail:from:name' => 'string|max:255',
|
||||
'mail:from:name' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -31,7 +32,7 @@ class MailSettingsFormRequest extends AdminFormRequest
|
|||
* @param array $only
|
||||
* @return array
|
||||
*/
|
||||
public function normalize($only = [])
|
||||
public function normalize(array $only = null)
|
||||
{
|
||||
$keys = array_flip(array_keys($this->rules()));
|
||||
|
||||
|
|
|
@ -30,17 +30,17 @@ class SettingsRepository extends EloquentRepository implements SettingsRepositor
|
|||
/**
|
||||
* Store a new persistent setting in the database.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param string|null $value
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function set(string $key, string $value)
|
||||
public function set(string $key, string $value = null)
|
||||
{
|
||||
// Clear item from the cache.
|
||||
$this->clearCache($key);
|
||||
$this->withoutFreshModel()->updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
$this->withoutFreshModel()->updateOrCreate(['key' => $key], ['value' => $value ?? '']);
|
||||
|
||||
self::$cache[$key] = $value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue