Merge branch 'develop' into feature/api-v1
This commit is contained in:
commit
46d7ba7585
32 changed files with 247 additions and 201 deletions
|
@ -9,6 +9,7 @@ use Pterodactyl\Exceptions\DisplayException;
|
|||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Translation\Translator;
|
||||
use Pterodactyl\Services\Users\UserUpdateService;
|
||||
use Pterodactyl\Traits\Helpers\AvailableLanguages;
|
||||
use Pterodactyl\Services\Users\UserCreationService;
|
||||
use Pterodactyl\Services\Users\UserDeletionService;
|
||||
use Pterodactyl\Http\Requests\Admin\UserFormRequest;
|
||||
|
@ -16,6 +17,8 @@ use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
|
|||
|
||||
class UserController extends Controller
|
||||
{
|
||||
use AvailableLanguages;
|
||||
|
||||
/**
|
||||
* @var \Prologue\Alerts\AlertsMessageBag
|
||||
*/
|
||||
|
@ -92,7 +95,9 @@ class UserController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.users.new');
|
||||
return view('admin.users.new', [
|
||||
'languages' => $this->getAvailableLanguages(true),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +108,10 @@ class UserController extends Controller
|
|||
*/
|
||||
public function view(User $user)
|
||||
{
|
||||
return view('admin.users.view', ['user' => $user]);
|
||||
return view('admin.users.view', [
|
||||
'user' => $user,
|
||||
'languages' => $this->getAvailableLanguages(true),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Requests\Admin;
|
||||
|
||||
|
@ -39,11 +32,11 @@ abstract class AdminFormRequest extends FormRequest
|
|||
* Return only the fields that we are interested in from the request.
|
||||
* This will include empty fields as a null value.
|
||||
*
|
||||
* @param array $only
|
||||
* @param array|null $only
|
||||
* @return array
|
||||
*/
|
||||
public function normalize($only = [])
|
||||
public function normalize(array $only = null)
|
||||
{
|
||||
return $this->all(empty($only) ? array_keys($this->rules()) : $only);
|
||||
return $this->only($only ?? array_keys($this->rules()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,16 @@ class UserFormRequest extends AdminFormRequest
|
|||
return User::getCreateRules();
|
||||
}
|
||||
|
||||
public function normalize($only = [])
|
||||
/**
|
||||
* @param array|null $only
|
||||
* @return array
|
||||
*/
|
||||
public function normalize(array $only = null)
|
||||
{
|
||||
if ($this->method === 'PATCH') {
|
||||
return array_merge(
|
||||
$this->all(['password']),
|
||||
$this->only(['email', 'username', 'name_first', 'name_last', 'root_admin', 'ignore_connection_error'])
|
||||
$this->only(['email', 'username', 'name_first', 'name_last', 'root_admin', 'language', 'ignore_connection_error'])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue