Fix config key names (#4464)
This commit is contained in:
		
							parent
							
								
									7266c66ebf
								
							
						
					
					
						commit
						e49ba65709
					
				| @ -49,7 +49,7 @@ class EmailSettingsCommand extends Command | |||||||
|                 'mandrill' => 'Mandrill Transactional Email', |                 'mandrill' => 'Mandrill Transactional Email', | ||||||
|                 'postmark' => 'Postmark 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'; |         $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; | ||||||
| @ -86,17 +86,17 @@ class EmailSettingsCommand extends Command | |||||||
|     { |     { | ||||||
|         $this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask( |         $this->variables['MAIL_HOST'] = $this->option('host') ?? $this->ask( | ||||||
|             trans('command/messages.environment.mail.ask_smtp_host'), |             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( |         $this->variables['MAIL_PORT'] = $this->option('port') ?? $this->ask( | ||||||
|             trans('command/messages.environment.mail.ask_smtp_port'), |             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( |         $this->variables['MAIL_USERNAME'] = $this->option('username') ?? $this->ask( | ||||||
|             trans('command/messages.environment.mail.ask_smtp_username'), |             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( |         $this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret( | ||||||
|  | |||||||
| @ -58,15 +58,16 @@ class InfoCommand extends Command | |||||||
|             ['Username', $this->config->get("database.connections.$driver.username")], |             ['Username', $this->config->get("database.connections.$driver.username")], | ||||||
|         ], 'compact'); |         ], 'compact'); | ||||||
| 
 | 
 | ||||||
|  |         // TODO: Update this to handle other mail drivers
 | ||||||
|         $this->output->title('Email Configuration'); |         $this->output->title('Email Configuration'); | ||||||
|         $this->table([], [ |         $this->table([], [ | ||||||
|             ['Driver', $this->config->get('mail.driver')], |             ['Driver', $this->config->get('mail.default')], | ||||||
|             ['Host', $this->config->get('mail.host')], |             ['Host', $this->config->get('mail.mailers.smtp.host')], | ||||||
|             ['Port', $this->config->get('mail.port')], |             ['Port', $this->config->get('mail.mailers.smtp.port')], | ||||||
|             ['Username', $this->config->get('mail.username')], |             ['Username', $this->config->get('mail.mailers.smtp.username')], | ||||||
|             ['From Address', $this->config->get('mail.from.address')], |             ['From Address', $this->config->get('mail.from.address')], | ||||||
|             ['From Name', $this->config->get('mail.from.name')], |             ['From Name', $this->config->get('mail.from.name')], | ||||||
|             ['Encryption', $this->config->get('mail.encryption')], |             ['Encryption', $this->config->get('mail.mailers.smtp.encryption')], | ||||||
|         ], 'compact'); |         ], 'compact'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -39,7 +39,7 @@ class MailController extends Controller | |||||||
|     public function index(): View |     public function index(): View | ||||||
|     { |     { | ||||||
|         return $this->view->make('admin.settings.mail', [ |         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 @@ class MailController extends Controller | |||||||
|      */ |      */ | ||||||
|     public function update(MailSettingsFormRequest $request): Response |     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.'); |             throw new DisplayException('This feature is only available if SMTP is the selected email driver for the Panel.'); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,6 +19,7 @@ use Pterodactyl\Traits\Helpers\AvailableLanguages; | |||||||
| use Pterodactyl\Services\Users\UserCreationService; | use Pterodactyl\Services\Users\UserCreationService; | ||||||
| use Pterodactyl\Services\Users\UserDeletionService; | use Pterodactyl\Services\Users\UserDeletionService; | ||||||
| use Pterodactyl\Http\Requests\Admin\UserFormRequest; | use Pterodactyl\Http\Requests\Admin\UserFormRequest; | ||||||
|  | use Pterodactyl\Http\Requests\Admin\NewUserFormRequest; | ||||||
| use Pterodactyl\Contracts\Repository\UserRepositoryInterface; | use Pterodactyl\Contracts\Repository\UserRepositoryInterface; | ||||||
| 
 | 
 | ||||||
| class UserController extends Controller | class UserController extends Controller | ||||||
| @ -103,7 +104,7 @@ class UserController extends Controller | |||||||
|      * @throws \Exception |      * @throws \Exception | ||||||
|      * @throws \Throwable |      * @throws \Throwable | ||||||
|      */ |      */ | ||||||
|     public function store(UserFormRequest $request): RedirectResponse |     public function store(NewUserFormRequest $request): RedirectResponse | ||||||
|     { |     { | ||||||
|         $user = $this->creationService->handle($request->normalize()); |         $user = $this->creationService->handle($request->normalize()); | ||||||
|         $this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash(); |         $this->alert->success($this->translator->get('admin/user.notices.account_created'))->flash(); | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								app/Http/Requests/Admin/NewUserFormRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Http/Requests/Admin/NewUserFormRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | namespace Pterodactyl\Http\Requests\Admin; | ||||||
|  | 
 | ||||||
|  | use Pterodactyl\Models\User; | ||||||
|  | use Illuminate\Support\Collection; | ||||||
|  | 
 | ||||||
|  | class NewUserFormRequest extends AdminFormRequest | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Rules to apply to requests for updating or creating a user | ||||||
|  |      * in the Admin CP. | ||||||
|  |      */ | ||||||
|  |     public function rules(): array | ||||||
|  |     { | ||||||
|  |         return Collection::make( | ||||||
|  |             User::getRules() | ||||||
|  |         )->only([ | ||||||
|  |             'email', | ||||||
|  |             'username', | ||||||
|  |             'name_first', | ||||||
|  |             'name_last', | ||||||
|  |             'password', | ||||||
|  |             'language', | ||||||
|  |             'root_admin', | ||||||
|  |         ])->toArray(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -61,7 +61,7 @@ class SettingsServiceProvider extends ServiceProvider | |||||||
|     { |     { | ||||||
|         // Only set the email driver settings from the database if we
 |         // Only set the email driver settings from the database if we
 | ||||||
|         // are configured using SMTP as the driver.
 |         // 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); |             $this->keys = array_merge($this->keys, $this->emailKeys); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -38,14 +38,14 @@ | |||||||
|                                 <div class="form-group col-md-6"> |                                 <div class="form-group col-md-6"> | ||||||
|                                     <label class="control-label">SMTP Host</label> |                                     <label class="control-label">SMTP Host</label> | ||||||
|                                     <div> |                                     <div> | ||||||
|                                         <input required type="text" class="form-control" name="mail:host" value="{{ old('mail:host', config('mail.host')) }}" /> |                                         <input required type="text" class="form-control" name="mail:host" value="{{ old('mail:host', config('mail.mailers.smtp.host')) }}" /> | ||||||
|                                         <p class="text-muted small">Enter the SMTP server address that mail should be sent through.</p> |                                         <p class="text-muted small">Enter the SMTP server address that mail should be sent through.</p> | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </div> |                                 </div> | ||||||
|                                 <div class="form-group col-md-2"> |                                 <div class="form-group col-md-2"> | ||||||
|                                     <label class="control-label">SMTP Port</label> |                                     <label class="control-label">SMTP Port</label> | ||||||
|                                     <div> |                                     <div> | ||||||
|                                         <input required type="number" class="form-control" name="mail:port" value="{{ old('mail:port', config('mail.port')) }}" /> |                                         <input required type="number" class="form-control" name="mail:port" value="{{ old('mail:port', config('mail.mailers.smtp.port')) }}" /> | ||||||
|                                         <p class="text-muted small">Enter the SMTP server port that mail should be sent through.</p> |                                         <p class="text-muted small">Enter the SMTP server port that mail should be sent through.</p> | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </div> |                                 </div> | ||||||
| @ -53,7 +53,7 @@ | |||||||
|                                     <label class="control-label">Encryption</label> |                                     <label class="control-label">Encryption</label> | ||||||
|                                     <div> |                                     <div> | ||||||
|                                         @php |                                         @php | ||||||
|                                             $encryption = old('mail:encryption', config('mail.encryption')); |                                             $encryption = old('mail:encryption', config('mail.mailers.smtp.encryption')); | ||||||
|                                         @endphp |                                         @endphp | ||||||
|                                         <select name="mail:encryption" class="form-control"> |                                         <select name="mail:encryption" class="form-control"> | ||||||
|                                             <option value="" @if($encryption === '') selected @endif>None</option> |                                             <option value="" @if($encryption === '') selected @endif>None</option> | ||||||
| @ -66,7 +66,7 @@ | |||||||
|                                 <div class="form-group col-md-6"> |                                 <div class="form-group col-md-6"> | ||||||
|                                     <label class="control-label">Username <span class="field-optional"></span></label> |                                     <label class="control-label">Username <span class="field-optional"></span></label> | ||||||
|                                     <div> |                                     <div> | ||||||
|                                         <input type="text" class="form-control" name="mail:username" value="{{ old('mail:username', config('mail.username')) }}" /> |                                         <input type="text" class="form-control" name="mail:username" value="{{ old('mail:username', config('mail.mailers.smtp.username')) }}" /> | ||||||
|                                         <p class="text-muted small">The username to use when connecting to the SMTP server.</p> |                                         <p class="text-muted small">The username to use when connecting to the SMTP server.</p> | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </div> |                                 </div> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Lance Pioch
						Lance Pioch