Merge branch 'develop' into feature/service-changes

This commit is contained in:
Dane Everitt 2017-01-12 13:15:37 -05:00
commit 6bd9663f59
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
136 changed files with 2470 additions and 1737 deletions

View file

@ -27,6 +27,7 @@ namespace Pterodactyl\Http\Controllers\Admin;
use DB;
use Log;
use Alert;
use Carbon;
use Validator;
use Pterodactyl\Models;
use Illuminate\Http\Request;
@ -82,6 +83,7 @@ class NodesController extends Controller
'_token',
]));
Alert::success('Successfully created new node. <strong>Before you can add any servers you need to first assign some IP addresses and ports.</strong>')->flash();
Alert::info('<strong>To simplify the node setup you can generate a token on the configuration tab.</strong>')->flash();
return redirect()->route('admin.nodes.view', [
'id' => $new,
@ -276,4 +278,24 @@ class NodesController extends Controller
'tab' => 'tab_delete',
]);
}
public function getConfigurationToken(Request $request, $id)
{
// Check if Node exists. Will lead to 404 if not.
Models\Node::findOrFail($id);
// Create a token
$token = new Models\NodeConfigurationToken();
$token->node = $id;
$token->token = str_random(32);
$token->expires_at = Carbon::now()->addMinutes(5); // Expire in 5 Minutes
$token->save();
$token_response = [
'token' => $token->token,
'expires_at' => $token->expires_at->toDateTimeString(),
];
return response()->json($token_response, 200);
}
}

View file

@ -232,7 +232,7 @@ class ServiceController extends Controller
]));
Alert::success('Successfully added new variable to this option.')->flash();
return redirect()->route('admin.services.option', [$service, $option])->withInput();
return redirect()->route('admin.services.option', [$service, $option]);
} catch (DisplayValidationException $ex) {
return redirect()->route('admin.services.option.variable.new', [$service, $option])->withErrors(json_decode($ex->getMessage()))->withInput();
} catch (DisplayException $ex) {