Made it so users can switch languages themselves

This commit is contained in:
stanjg 2018-05-04 13:08:41 +02:00
parent 9a06647435
commit 9ae25538c3
No known key found for this signature in database
GPG key ID: 27D9DF9D28935303
3 changed files with 20 additions and 2 deletions

View file

@ -7,9 +7,12 @@ use Prologue\Alerts\AlertsMessageBag;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Services\Users\UserUpdateService;
use Pterodactyl\Http\Requests\Base\AccountDataFormRequest;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
class AccountController extends Controller
{
use AvailableLanguages;
/**
* @var \Prologue\Alerts\AlertsMessageBag
*/
@ -39,7 +42,9 @@ class AccountController extends Controller
*/
public function index()
{
return view('base.account');
return view('base.account', [
'languages' => $this->getAvailableLanguages(true),
]);
}
/**
@ -60,7 +65,7 @@ class AccountController extends Controller
} elseif ($request->input('do_action') === 'email') {
$data['email'] = $request->input('new_email');
} elseif ($request->input('do_action') === 'identity') {
$data = $request->only(['name_first', 'name_last', 'username']);
$data = $request->only(['name_first', 'name_last', 'username', 'language']);
}
$this->updateService->setUserLevel(User::USER_LEVEL_USER);

View file

@ -64,6 +64,7 @@ return [
'last_name' => 'Last Name',
'update_identitity' => 'Update Identity',
'username_help' => 'Your username must be unique to your account, and may only contain the following characters: :requirements.',
'language' => 'Language',
],
'security' => [
'session_mgmt_disabled' => 'Your host has not enabled the ability to manage account sessions via this interface.',

View file

@ -90,6 +90,18 @@
</div>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="language" class="control-label">@lang('base.account.language')</label>
<div>
<select name="language" id="language" class="form-control">
@foreach($languages as $key => $value)
<option value="{{ $key }}" {{ Auth::user()->language !== $key ?: 'selected' }}>{{ $value }}</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
<div class="box-footer with-border">
{!! csrf_field() !!}