From 8e9069cced6f7d41321deb00cedd0a2086389894 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 21 Jan 2017 00:04:09 -0500 Subject: [PATCH] Subuser updates --- app/Repositories/SubuserRepository.php | 9 +- resources/lang/en/server.php | 9 +- .../pterodactyl/server/users/new.blade.php | 3 +- .../pterodactyl/server/users/view.blade.php | 417 ++++++++++++++++++ 4 files changed, 433 insertions(+), 5 deletions(-) create mode 100644 resources/themes/pterodactyl/server/users/view.blade.php diff --git a/app/Repositories/SubuserRepository.php b/app/Repositories/SubuserRepository.php index dfc72b38b..a25c7f12e 100644 --- a/app/Repositories/SubuserRepository.php +++ b/app/Repositories/SubuserRepository.php @@ -133,10 +133,15 @@ class SubuserRepository // Determine if this user exists or if we need to make them an account. $user = Models\User::where('email', $data['email'])->first(); if (! $user) { - $password = str_random(16); try { $repo = new UserRepository; - $uid = $repo->create($data['email'], $password); + $uid = $repo->create([ + 'email' => $data['email'], + 'username' => substr(str_replace('@', '', $data['email']), 0, 8), + 'name_first' => 'John', + 'name_last' => 'Doe', + 'root_admin' => false, + ]); $user = Models\User::findOrFail($uid); } catch (\Exception $ex) { throw $ex; diff --git a/resources/lang/en/server.php b/resources/lang/en/server.php index 656430dac..bfb304f55 100644 --- a/resources/lang/en/server.php +++ b/resources/lang/en/server.php @@ -12,6 +12,11 @@ return [ 'configure' => 'Configure Permissions', 'list' => 'Accounts with Access', 'add' => 'Add New Subuser', + 'update' => 'Update Subuser', + 'edit' => [ + 'header' => 'Edit Subuser', + 'header_sub' => 'Modify user\'s access to server.' + ], 'new' => [ 'header' => 'Add New User', 'header_sub' => 'Add a new user with permissions to this server.', @@ -33,11 +38,11 @@ return [ 'description' => 'Allows user to stop the server.', ], 'restart' => [ - 'title' => 'Stop Server', + 'title' => 'Restart Server', 'description' => 'Allows user to restart the server.', ], 'kill' => [ - 'title' => 'Stop Server', + 'title' => 'Kill Server', 'description' => 'Allows user to kill the server process.', ], 'command' => [ diff --git a/resources/themes/pterodactyl/server/users/new.blade.php b/resources/themes/pterodactyl/server/users/new.blade.php index 3ee194c45..6236be984 100644 --- a/resources/themes/pterodactyl/server/users/new.blade.php +++ b/resources/themes/pterodactyl/server/users/new.blade.php @@ -43,7 +43,8 @@
- + {!! csrf_field() !!} +

@lang('server.users.new.email_help')

diff --git a/resources/themes/pterodactyl/server/users/view.blade.php b/resources/themes/pterodactyl/server/users/view.blade.php new file mode 100644 index 000000000..129a403b9 --- /dev/null +++ b/resources/themes/pterodactyl/server/users/view.blade.php @@ -0,0 +1,417 @@ +{{-- Copyright (c) 2015 - 2016 Dane Everitt --}} + +{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}} +{{-- of this software and associated documentation files (the "Software"), to deal --}} +{{-- in the Software without restriction, including without limitation the rights --}} +{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}} +{{-- copies of the Software, and to permit persons to whom the Software is --}} +{{-- furnished to do so, subject to the following conditions: --}} + +{{-- The above copyright notice and this permission notice shall be included in all --}} +{{-- copies or substantial portions of the Software. --}} + +{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}} +{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}} +{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}} +{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}} +{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}} +{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}} +{{-- SOFTWARE. --}} +@extends('layouts.master') + +@section('title') + @lang('server.users.new.header') +@endsection + +@section('content-header') +

@lang('server.users.edit.header')@lang('server.users.edit.header_sub')

+ +@endsection + +@section('content') +@can('edit-subuser', $server) +
+@endcan +
+
+
+
+
+ +
+ {!! csrf_field() !!} + +
+
+
+ @can('edit-subuser', $server) + + @endcan +
+
+
+
+
+ {{-- Left Side --}} +
+
+
+
+

@lang('server.users.new.power_header')

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+

@lang('server.users.new.subuser_header')

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+

@lang('server.users.new.server_header')

+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+

@lang('server.users.new.sftp_header')

+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+ {{-- Right Side --}} +
+
+
+
+

@lang('server.users.new.file_header')

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+

@lang('server.users.new.task_header')

+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+

@lang('server.users.new.db_header')

+
+
+
+ +
+
+ +
+
+
+
+
+
+
+@can('edit-subuser', $server) +
+@endcan +@endsection + +@section('footer-scripts') + @parent + +@endsection