parent
48b9bc0c52
commit
f6be06164f
13 changed files with 345 additions and 362 deletions
|
@ -1,145 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use Alert;
|
||||
use Settings;
|
||||
use Mail;
|
||||
use Log;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Repositories\UserRepository;
|
||||
use Pterodactyl\Models\Server;
|
||||
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AccountsController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Controller Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
return view('admin.accounts.index', [
|
||||
'users' => User::paginate(20)
|
||||
]);
|
||||
}
|
||||
|
||||
public function getNew(Request $request)
|
||||
{
|
||||
return view('admin.accounts.new');
|
||||
}
|
||||
|
||||
public function getView(Request $request, $id)
|
||||
{
|
||||
return view('admin.accounts.view', [
|
||||
'user' => User::findOrFail($id),
|
||||
'servers' => Server::select('servers.*', 'nodes.name as nodeName', 'locations.long as location')
|
||||
->join('nodes', 'servers.node', '=', 'nodes.id')
|
||||
->join('locations', 'nodes.location', '=', 'locations.id')
|
||||
->where('owner', $id)
|
||||
->where('active', 1)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteView(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
User::findOrFail($id)->delete();
|
||||
return response(null, 204);
|
||||
} catch(\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return response()->json([
|
||||
'error' => 'An error occured while attempting to delete this user.'
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function postNew(Request $request)
|
||||
{
|
||||
try {
|
||||
$user = new UserRepository;
|
||||
$userid = $user->create($request->input('email'), $request->input('password'));
|
||||
Alert::success('Account has been successfully created.')->flash();
|
||||
return redirect()->route('admin.accounts.view', ['id' => $userid]);
|
||||
} catch (\Pterodactyl\Exceptions\DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.accounts.new')->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An error occured while attempting to add a new user. ' . $ex->getMessage())->flash();
|
||||
return redirect()->route('admin.accounts.new');
|
||||
}
|
||||
}
|
||||
|
||||
public function postUpdate(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'email' => 'required|email|unique:users,email,'.$request->input('user'),
|
||||
'root_admin' => 'required',
|
||||
'password' => 'required_with:password_confirmation|confirmed',
|
||||
'password_confirmation' => 'required_with:password'
|
||||
]);
|
||||
|
||||
try {
|
||||
|
||||
$users = new UserRepository;
|
||||
$user = [
|
||||
'email' => $request->input('email'),
|
||||
'root_admin' => $request->input('root_admin')
|
||||
];
|
||||
|
||||
if(!empty($request->input('password'))) {
|
||||
$user['password'] = $request->input('password');
|
||||
}
|
||||
|
||||
if(!$users->update($request->input('user'), $user)) {
|
||||
throw new \Exception('Unable to update user, response was not valid.');
|
||||
}
|
||||
|
||||
if($request->input('email_user')) {
|
||||
Mail::queue('emails.new_password', ['user' => User::findOrFail($request->input('user')), 'password' => $request->input('password')], function($message) use ($request) {
|
||||
$message->to($request->input('email'))->subject(Settings::get('company') . ' - Admin Reset Password');
|
||||
$message->from(Settings::get('email_from', env('MAIL_FROM')), Settings::get('email_sender_name', env('MAIL_FROM_NAME', 'Pterodactyl Panel')));
|
||||
});
|
||||
}
|
||||
|
||||
Alert::success('User account was successfully updated.')->flash();
|
||||
return redirect()->route('admin.accounts.view', ['id' => $request->input('user')]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
Alert::danger('An error occured while attempting to update this user. ' . $e->getMessage())->flash();
|
||||
return redirect()->route('admin.accounts.view', ['id' => $request->input('user')]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
134
app/Http/Controllers/Admin/UserController.php
Normal file
134
app/Http/Controllers/Admin/UserController.php
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use Alert;
|
||||
use Settings;
|
||||
use Mail;
|
||||
use Log;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Repositories\UserRepository;
|
||||
use Pterodactyl\Models\Server;
|
||||
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Controller Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getIndex(Request $request)
|
||||
{
|
||||
return view('admin.users.index', [
|
||||
'users' => User::paginate(20)
|
||||
]);
|
||||
}
|
||||
|
||||
public function getNew(Request $request)
|
||||
{
|
||||
return view('admin.users.new');
|
||||
}
|
||||
|
||||
public function getView(Request $request, $id)
|
||||
{
|
||||
return view('admin.users.view', [
|
||||
'user' => User::findOrFail($id),
|
||||
'servers' => Server::select('servers.*', 'nodes.name as nodeName', 'locations.long as location')
|
||||
->join('nodes', 'servers.node', '=', 'nodes.id')
|
||||
->join('locations', 'nodes.location', '=', 'locations.id')
|
||||
->where('owner', $id)
|
||||
->where('active', 1)
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteUser(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$repo = new UserRepository;
|
||||
$repo->delete($id);
|
||||
Alert::success('Successfully deleted user from system.')->flash();
|
||||
return redirect()->route('admin.users');
|
||||
} catch(DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An exception was encountered while attempting to delete this user.')->flash();
|
||||
}
|
||||
return redirect()->route('admin.users.view', $id);
|
||||
}
|
||||
|
||||
public function postNew(Request $request)
|
||||
{
|
||||
try {
|
||||
$user = new UserRepository;
|
||||
$userid = $user->create($request->input('email'), $request->input('password'));
|
||||
Alert::success('Account has been successfully created.')->flash();
|
||||
return redirect()->route('admin.users.view', $userid);
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.users.new')->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An error occured while attempting to add a new user.')->flash();
|
||||
return redirect()->route('admin.users.new');
|
||||
}
|
||||
}
|
||||
|
||||
public function updateUser(Request $request, $user)
|
||||
{
|
||||
$data = [
|
||||
'email' => $request->input('email'),
|
||||
'root_admin' => $request->input('root_admin'),
|
||||
'password_confirmation' => $request->input('password_confirmation'),
|
||||
];
|
||||
|
||||
if ($request->input('password')) {
|
||||
$data['password'] = $request->input('password');
|
||||
}
|
||||
|
||||
try {
|
||||
$repo = new UserRepository;
|
||||
$repo->update($user, $data);
|
||||
Alert::success('User account was successfully updated.')->flash();
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.users.view', $user)->withErrors(json_decode($ex->getMessage()));
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
Alert::danger('An error occured while attempting to update this user.')->flash();
|
||||
}
|
||||
return redirect()->route('admin.users.view', $user);
|
||||
}
|
||||
|
||||
}
|
|
@ -59,7 +59,7 @@ class AdminRoutes {
|
|||
});
|
||||
|
||||
$router->group([
|
||||
'prefix' => 'admin/accounts',
|
||||
'prefix' => 'admin/users',
|
||||
'middleware' => [
|
||||
'auth',
|
||||
'admin',
|
||||
|
@ -69,35 +69,35 @@ class AdminRoutes {
|
|||
|
||||
// View All Accounts on System
|
||||
$router->get('/', [
|
||||
'as' => 'admin.accounts',
|
||||
'uses' => 'Admin\AccountsController@getIndex'
|
||||
'as' => 'admin.users',
|
||||
'uses' => 'Admin\UserController@getIndex'
|
||||
]);
|
||||
|
||||
// View Specific Account
|
||||
$router->get('/view/{id}', [
|
||||
'as' => 'admin.accounts.view',
|
||||
'uses' => 'Admin\AccountsController@getView'
|
||||
'as' => 'admin.users.view',
|
||||
'uses' => 'Admin\UserController@getView'
|
||||
]);
|
||||
|
||||
// Show Create Account Page
|
||||
$router->get('/new', [
|
||||
'as' => 'admin.accounts.new',
|
||||
'uses' => 'Admin\AccountsController@getNew'
|
||||
]);
|
||||
|
||||
// Handle Creating New Account
|
||||
$router->post('/new', [
|
||||
'uses' => 'Admin\AccountsController@postNew'
|
||||
]);
|
||||
|
||||
// Update A Specific Account
|
||||
$router->post('/update', [
|
||||
'uses' => 'Admin\AccountsController@postUpdate'
|
||||
// View Specific Account
|
||||
$router->post('/view/{id}', [
|
||||
'uses' => 'Admin\UserController@updateUser'
|
||||
]);
|
||||
|
||||
// Delete an Account Matching an ID
|
||||
$router->delete('/view/{id}', [
|
||||
'uses' => 'Admin\AccountsController@deleteView'
|
||||
'uses' => 'Admin\UserController@deleteUser'
|
||||
]);
|
||||
|
||||
// Show Create Account Page
|
||||
$router->get('/new', [
|
||||
'as' => 'admin.users.new',
|
||||
'uses' => 'Admin\UserController@getNew'
|
||||
]);
|
||||
|
||||
// Handle Creating New Account
|
||||
$router->post('/new', [
|
||||
'uses' => 'Admin\UserController@postNew'
|
||||
]);
|
||||
|
||||
});
|
||||
|
|
|
@ -108,13 +108,15 @@ class UserRepository
|
|||
*/
|
||||
public function update($id, array $data)
|
||||
{
|
||||
$user = Models\User::findOrFail($id);
|
||||
|
||||
$validator = Validator::make($data, [
|
||||
'email' => 'email|unique:users,email,' . $id,
|
||||
'password' => 'regex:((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})',
|
||||
'root_admin' => 'boolean',
|
||||
'language' => 'string|min:1|max:5',
|
||||
'use_totp' => 'boolean',
|
||||
'totp_secret' => 'size:16'
|
||||
'email' => 'sometimes|required|email|unique:users,email,' . $id,
|
||||
'password' => 'sometimes|required|regex:((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})',
|
||||
'root_admin' => 'sometimes|required|boolean',
|
||||
'language' => 'sometimes|required|string|min:1|max:5',
|
||||
'use_totp' => 'sometimes|required|boolean',
|
||||
'totp_secret' => 'sometimes|required|size:16'
|
||||
]);
|
||||
|
||||
// Run validator, throw catchable and displayable exception if it fails.
|
||||
|
@ -127,7 +129,12 @@ class UserRepository
|
|||
$data['password'] = Hash::make($data['password']);
|
||||
}
|
||||
|
||||
return Models\User::findOrFail($id)->update($data);
|
||||
if (isset($data['password_confirmation'])) {
|
||||
unset($data['password_confirmation']);
|
||||
}
|
||||
|
||||
$user->fill($data);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,14 +151,15 @@ class UserRepository
|
|||
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
Models\Permission::where('user_id', $id)->delete();
|
||||
Models\Subuser::where('user_id', $id)->delete();
|
||||
Models\User::destroy($id);
|
||||
|
||||
try {
|
||||
DB::commit();
|
||||
return true;
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollBack();
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ return [
|
|||
'no_servers' => 'You do not currently have any servers listed on your account.',
|
||||
'form_error' => 'The following errors were encountered while trying to process this request.',
|
||||
'password_req' => 'Passwords must meet the following requirements: at least one uppercase character, one lowercase character, one digit, and be at least 8 characters in length.',
|
||||
'root_administrator' => 'Setting this to "Yes" gives a user full administrative access to PufferPanel.',
|
||||
|
||||
'account' => [
|
||||
'totp_header' => 'Two-Factor Authentication',
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
{{-- Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
{{-- Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com> --}}
|
||||
|
||||
{{-- 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.admin')
|
||||
|
||||
@section('title')
|
||||
Viewing User
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="/admin">Admin Controls</a></li>
|
||||
<li><a href="/admin/accounts">Accounts</a></li>
|
||||
<li class="active">{{ $user->email }}</li>
|
||||
</ul>
|
||||
<h3>Viewing User: {{ $user->email }}</h3><hr />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form action="/admin/accounts/update" method="post">
|
||||
<div class="col-md-6">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<label for="email" class="control-label">{{ trans('strings.email') }}</label>
|
||||
<div>
|
||||
<input type="text" name="email" value="{{ $user->email }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registered" class="control-label">{{ trans('strings.registered') }}</label>
|
||||
<div>
|
||||
<input type="text" name="registered" value="{{ $user->created_at }}" readonly="readonly" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="root_admin" class="control-label">{{ trans('strings.root_administrator') }}</label>
|
||||
<div>
|
||||
<select name="root_admin" class="form-control">
|
||||
<option value="0">{{ trans('strings.no') }}</option>
|
||||
<option value="1" @if($user->root_admin)selected="selected"@endif>{{ trans('strings.yes') }}</option>
|
||||
</select>
|
||||
<p><small class="text-muted"><em><strong><i class="fa fa-warning"></i></strong> {{ trans('base.root_administrator') }}</em></small></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="user" value="{{ $user->id }}">
|
||||
{!! csrf_field() !!}
|
||||
<input type="submit" value="{{ trans('base.account.update_user') }}" class="btn btn-primary btn-sm">
|
||||
<a href="#">
|
||||
<button type="button" class="btn btn-sm btn-danger" data-action="deleteUser" value="{{ trans('base.account.delete_user') }}">{{ trans('base.account.delete_user') }}</button>
|
||||
</a>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="well" style="padding-bottom: 0;">
|
||||
<h4 class="nopad">{{ trans('base.account.update_pass') }}</h5><hr>
|
||||
<div class="alert alert-success" style="display:none;margin-bottom:10px;" id="gen_pass"></div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="control-label">{{ trans('strings.password') }}</label>
|
||||
<div>
|
||||
<input type="password" id="password" name="password" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password_confirmation" class="control-label">{{ trans('auth.confirmpassword') }}</label>
|
||||
<div>
|
||||
<input type="password" id="password_confirmation" name="password_confirmation" class="form-control">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" name="email_user" value="1">{{ trans('base.account.email_password') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-default btn-sm" id="gen_pass_bttn" type="button">Generate Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Associated Servers</h3><hr>
|
||||
@if($servers)
|
||||
<table class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:2%;"></th>
|
||||
<th>Server Name</th>
|
||||
<th>Node</th>
|
||||
<th>Connection</th>
|
||||
<th style="width:10%;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($servers as $server)
|
||||
<tr>
|
||||
<td><a href="/server/{{ $server->uuidShort }}/"><i class="fa fa-tachometer"></i></a></td>
|
||||
<td><a href="/admin/servers/view/{{ $server->id }}">{{ $server->name }}</a></td>
|
||||
<td>{{ $server->nodeName }}</td>
|
||||
<td><code>{{ $server->ip }}:{{ $server->port }}</code></td>
|
||||
<td>@if($server->active)<span class="label label-success">Enabled</span>@else<span class="label label-danger">Disabled</span>@endif</td>
|
||||
</td>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<div class="alert alert-info">There are no servers associated with this account.</div>
|
||||
@endif
|
||||
<a href="/admin/servers/new?email={{ $user->email }}"><button type="button" class="btn btn-success btn-sm">{{ trans('server.index.add_new') }}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#sidebar_links").find("a[href='/admin/accounts']").addClass('active');
|
||||
$('#delete').click(function() {
|
||||
if(confirm('{{ trans('base.confirm') }}')) {
|
||||
$('#delete').load($(this).attr('href'));
|
||||
}
|
||||
});
|
||||
$("#gen_pass_bttn").click(function(e){
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/password-gen/12",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(data) {
|
||||
$("#gen_pass").html('<strong>Generated Password:</strong> ' + data).slideDown();
|
||||
$('input[name="password"], input[name="password_confirmation"]').val(data);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('button[data-action="deleteUser"]').click(function (event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
method: 'DELETE',
|
||||
url: '/admin/accounts/view/{{ $user->id }}',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
}).done(function (data) {
|
||||
alert('Account was successfully deleted from the system.');
|
||||
window.location = '/admin/accounts';
|
||||
}).fail(function (jqXHR) {
|
||||
console.error(jqXHR);
|
||||
alert('An error occured: ' + jqXHR.JSONResponse.error);
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -44,7 +44,7 @@
|
|||
@foreach ($servers as $server)
|
||||
<tr class="dynUpdate @if($server->active !== 1)active @endif" id="{{ $server->uuidShort }}">
|
||||
<td><a href="/admin/servers/view/{{ $server->id }}">{{ $server->name }}</td>
|
||||
<td><a href="/admin/accounts/view/{{ $server->owner }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
<td><a href="/admin/users/view/{{ $server->owner }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
<td class="hidden-xs"><a href="/admin/nodes/view/{{ $server->node }}">{{ $server->a_nodeName }}</a></td>
|
||||
<td><code>{{ $server->ip }}:{{ $server->port }}</code></td>
|
||||
<td class="hidden-xs"><code>{{ $server->username }}</code></td>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Owner</td>
|
||||
<td><a href="{{ route('admin.accounts.view', $server->owner) }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
<td><a href="{{ route('admin.users.view', $server->owner) }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Location</td>
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
@foreach ($servers as $server)
|
||||
<tr>
|
||||
<td><a href="{{ route('admin.servers.view', $server->id) }}">{{ $server->name }}</a></td>
|
||||
<td><a href="{{ route('admin.accounts.view', $server->owner) }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
<td><a href="{{ route('admin.users.view', $server->owner) }}">{{ $server->a_ownerEmail }}</a></td>
|
||||
<td><code>{{ $server->ip }}:{{ $server->port }}</code></td>
|
||||
<td>{{ $server->updated_at }}</td>
|
||||
</tr>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<tbody>
|
||||
@foreach ($users as $user)
|
||||
<tr>
|
||||
<td><a href="/admin/accounts/view/{{ $user->id }}"><code>{{ $user->email }}</code></a> @if($user->root_admin === 1)<span class="badge">Administrator</span>@endif</td>
|
||||
<td><a href="/admin/users/view/{{ $user->id }}"><code>{{ $user->email }}</code></a> @if($user->root_admin === 1)<span class="badge">Administrator</span>@endif</td>
|
||||
<td>{{ $user->created_at }}</td>
|
||||
<td>{{ $user->updated_at }}</td>
|
||||
</tr>
|
||||
|
@ -55,7 +55,7 @@
|
|||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#sidebar_links').find("a[href='/admin/accounts']").addClass('active');
|
||||
$('#sidebar_links').find("a[href='/admin/users']").addClass('active');
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -28,7 +28,7 @@
|
|||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="/admin">Admin Controls</a></li>
|
||||
<li><a href="/admin/accounts">Accounts</a></li>
|
||||
<li><a href="/admin/users">Accounts</a></li>
|
||||
<li class="active">Add New Account</li>
|
||||
</ul>
|
||||
<h3>Create New Account</h3><hr />
|
||||
|
@ -88,7 +88,7 @@ $(document).ready(function(){
|
|||
});
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$('#sidebar_links').find("a[href='/admin/accounts/new']").addClass('active');
|
||||
$('#sidebar_links').find("a[href='/admin/users/new']").addClass('active');
|
||||
});
|
||||
</script>
|
||||
@endsection
|
160
resources/views/admin/users/view.blade.php
Normal file
160
resources/views/admin/users/view.blade.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
{{-- Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
{{-- Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com> --}}
|
||||
|
||||
{{-- 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.admin')
|
||||
|
||||
@section('title')
|
||||
Viewing User
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="/admin">Admin Controls</a></li>
|
||||
<li><a href="/admin/users">Accounts</a></li>
|
||||
<li class="active">{{ $user->email }}</li>
|
||||
</ul>
|
||||
<h3>Viewing User: {{ $user->email }}</h3><hr />
|
||||
<div class="row">
|
||||
<form action="{{ route('admin.users.view', $user->id) }}" method="post">
|
||||
<div class="col-md-6">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<label for="email" class="control-label">{{ trans('strings.email') }}</label>
|
||||
<div>
|
||||
<input type="text" name="email" value="{{ $user->email }}" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="registered" class="control-label">{{ trans('strings.registered') }}</label>
|
||||
<div>
|
||||
<input type="text" value="{{ $user->created_at }}" readonly="readonly" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="root_admin" class="control-label">{{ trans('strings.root_administrator') }}</label>
|
||||
<div>
|
||||
<select name="root_admin" class="form-control">
|
||||
<option value="0">{{ trans('strings.no') }}</option>
|
||||
<option value="1" @if($user->root_admin)selected="selected"@endif>{{ trans('strings.yes') }}</option>
|
||||
</select>
|
||||
<p class="text-muted"><small>Setting this to 'Yes' gives a user full administrative access.</small></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{!! csrf_field() !!}
|
||||
<input type="submit" value="{{ trans('base.account.update_user') }}" class="btn btn-primary btn-sm">
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="well" style="padding-bottom: 0;">
|
||||
<h4 class="nopad">{{ trans('base.account.update_pass') }}</h5><hr />
|
||||
<div class="alert alert-success" style="display:none;margin-bottom:10px;" id="gen_pass"></div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="control-label">{{ trans('strings.password') }}</label>
|
||||
<div>
|
||||
<input type="password" id="password" name="password" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password_confirmation" class="control-label">{{ trans('auth.confirmpassword') }}</label>
|
||||
<div>
|
||||
<input type="password" id="password_confirmation" name="password_confirmation" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-default btn-sm" id="gen_pass_bttn" type="button">Generate Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Associated Servers</h3><hr>
|
||||
@if($servers)
|
||||
<table class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:2%;"></th>
|
||||
<th>Server Name</th>
|
||||
<th>Node</th>
|
||||
<th>Connection</th>
|
||||
<th style="width:10%;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($servers as $server)
|
||||
<tr>
|
||||
<td><a href="/server/{{ $server->uuidShort }}/"><i class="fa fa-tachometer"></i></a></td>
|
||||
<td><a href="/admin/servers/view/{{ $server->id }}">{{ $server->name }}</a></td>
|
||||
<td>{{ $server->nodeName }}</td>
|
||||
<td><code>{{ $server->ip }}:{{ $server->port }}</code></td>
|
||||
<td>@if($server->active)<span class="label label-success">Enabled</span>@else<span class="label label-danger">Disabled</span>@endif</td>
|
||||
</td>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<div class="alert alert-info">There are no servers associated with this account.</div>
|
||||
@endif
|
||||
<a href="/admin/servers/new?email={{ $user->email }}"><button type="button" class="btn btn-success btn-sm">{{ trans('server.index.add_new') }}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Delete Account</h3><hr />
|
||||
<div class="alert alert-danger"><strong>Warning!</strong> There most be no servers associated with this account in order for it to be deleted.</div>
|
||||
<form action="{{ route('admin.users.view', $user->id) }}" method="POST">
|
||||
{!! method_field('DELETE') !!}
|
||||
{!! csrf_field() !!}
|
||||
<input type="submit" class="btn btn-sm btn-danger pull-right" value="Delete User" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#sidebar_links").find("a[href='/admin/users']").addClass('active');
|
||||
$('#delete').click(function() {
|
||||
if(confirm('{{ trans('base.confirm') }}')) {
|
||||
$('#delete').load($(this).attr('href'));
|
||||
}
|
||||
});
|
||||
$("#gen_pass_bttn").click(function (event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/password-gen/12",
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(data) {
|
||||
$("#gen_pass").html('<strong>Generated Password:</strong> ' + data).slideDown();
|
||||
$('input[name="password"], input[name="password_confirmation"]').val(data);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -65,10 +65,10 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Accounts <b class="caret"></b></a>
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">users <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/admin/accounts">Find Account</a></li>
|
||||
<li><a href="/admin/accounts/new">New Account</a></li>
|
||||
<li><a href="/admin/users">Find Account</a></li>
|
||||
<li><a href="/admin/users/new">New Account</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
@ -133,8 +133,8 @@
|
|||
</div>
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item list-group-item-heading"><strong>Account Management</strong></a>
|
||||
<a href="/admin/accounts" class="list-group-item">Find Account</a>
|
||||
<a href="/admin/accounts/new" class="list-group-item">New Account</a>
|
||||
<a href="/admin/users" class="list-group-item">Find Account</a>
|
||||
<a href="/admin/users/new" class="list-group-item">New Account</a>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<a href="#" class="list-group-item list-group-item-heading"><strong>Server Management</strong></a>
|
||||
|
|
Loading…
Reference in a new issue