diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index cae0094c0e..1fd9a2aeef 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -49,7 +49,7 @@ public function handle() 'mandrill' => 'Mandrill Transactional Email', 'postmark' => 'Postmark Transactional Email', ], - $this->config->get('mail.driver', 'smtp') + $this->config->get('mail.default', 'smtp') ); $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; @@ -86,17 +86,17 @@ private function setupSmtpDriverVariables() { $this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask( trans('command/messages.environment.mail.ask_smtp_host'), - $this->config->get('mail.host') + $this->config->get('mail.mailers.smtp.host') ); $this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask( trans('command/messages.environment.mail.ask_smtp_port'), - $this->config->get('mail.port') + $this->config->get('mail.mailers.smtp.port') ); $this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask( trans('command/messages.environment.mail.ask_smtp_username'), - $this->config->get('mail.username') + $this->config->get('mail.mailers.smtp.username') ); $this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret( diff --git a/app/Console/Commands/InfoCommand.php b/app/Console/Commands/InfoCommand.php index bc1d11792a..25c7744058 100644 --- a/app/Console/Commands/InfoCommand.php +++ b/app/Console/Commands/InfoCommand.php @@ -58,15 +58,16 @@ public function handle() ['Username', $this->config->get("database.connections.$driver.username")], ], 'compact'); + // TODO: Update this to handle other mail drivers $this->output->title('Email Configuration'); $this->table([], [ - ['Driver', $this->config->get('mail.driver')], - ['Host', $this->config->get('mail.host')], - ['Port', $this->config->get('mail.port')], - ['Username', $this->config->get('mail.username')], + ['Driver', $this->config->get('mail.default')], + ['Host', $this->config->get('mail.mailers.smtp.host')], + ['Port', $this->config->get('mail.mailers.smtp.port')], + ['Username', $this->config->get('mail.mailers.smtp.username')], ['From Address', $this->config->get('mail.from.address')], ['From Name', $this->config->get('mail.from.name')], - ['Encryption', $this->config->get('mail.encryption')], + ['Encryption', $this->config->get('mail.mailers.smtp.encryption')], ], 'compact'); } diff --git a/app/Http/Controllers/Admin/Settings/MailController.php b/app/Http/Controllers/Admin/Settings/MailController.php index 058e3a90e6..2db87fd58f 100644 --- a/app/Http/Controllers/Admin/Settings/MailController.php +++ b/app/Http/Controllers/Admin/Settings/MailController.php @@ -39,7 +39,7 @@ public function __construct( public function index(): View { return $this->view->make('admin.settings.mail', [ - 'disabled' => $this->config->get('mail.driver') !== 'smtp', + 'disabled' => $this->config->get('mail.default') !== 'smtp', ]); } @@ -52,7 +52,7 @@ public function index(): View */ public function update(MailSettingsFormRequest $request): Response { - if ($this->config->get('mail.driver') !== 'smtp') { + if ($this->config->get('mail.default') !== 'smtp') { throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.'); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 254a72f8c9..1d6db65691 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -19,6 +19,7 @@ use Pterodactyl\Services\Users\UserCreationService; use Pterodactyl\Services\Users\UserDeletionService; use Pterodactyl\Http\Requests\Admin\UserFormRequest; +use Pterodactyl\Http\Requests\Admin\NewUserFormRequest; use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class UserController extends Controller @@ -103,7 +104,7 @@ public function delete(Request $request, User $user): RedirectResponse * @throws \Exception * @throws \Throwable */ - public function store(UserFormRequest $request): RedirectResponse + public function store(NewUserFormRequest $request): RedirectResponse { $user = $this->creationService->handle($request->normalize()); $this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash(); diff --git a/app/Http/Requests/Admin/NewUserFormRequest.php b/app/Http/Requests/Admin/NewUserFormRequest.php new file mode 100644 index 0000000000..d8c1993801 --- /dev/null +++ b/app/Http/Requests/Admin/NewUserFormRequest.php @@ -0,0 +1,28 @@ +only([ + 'email', + 'username', + 'name_first', + 'name_last', + 'password', + 'language', + 'root_admin', + ])->toArray(); + } +} diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php index 5508ee0fbc..9c8a7445ec 100644 --- a/app/Providers/SettingsServiceProvider.php +++ b/app/Providers/SettingsServiceProvider.php @@ -61,7 +61,7 @@ public function boot(ConfigRepository $config, Encrypter $encrypter, Log $log, S { // Only set the email driver settings from the database if we // are configured using SMTP as the driver. - if ($config->get('mail.driver') === 'smtp') { + if ($config->get('mail.default') === 'smtp') { $this->keys = array_merge($this->keys, $this->emailKeys); } diff --git a/resources/views/admin/settings/mail.blade.php b/resources/views/admin/settings/mail.blade.php index 580271e02e..b134469954 100644 --- a/resources/views/admin/settings/mail.blade.php +++ b/resources/views/admin/settings/mail.blade.php @@ -38,14 +38,14 @@
- +

Enter the SMTP server address that mail should be sent through.

- +

Enter the SMTP server port that mail should be sent through.

@@ -53,7 +53,7 @@
@php - $encryption = old('mail:encryption', config('mail.encryption')); + $encryption = old('mail:encryption', config('mail.mailers.smtp.encryption')); @endphp +

The username to use when connecting to the SMTP server.