Merge branch 'develop' into feature/react-admin
This commit is contained in:
commit
49de31bf4c
24 changed files with 169 additions and 32 deletions
|
@ -5,10 +5,12 @@ namespace Pterodactyl\Services\Servers;
|
|||
use Illuminate\Support\Arr;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Allocation;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
|
||||
use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
|
||||
|
||||
class BuildModificationService
|
||||
{
|
||||
|
@ -78,10 +80,18 @@ class BuildModificationService
|
|||
|
||||
$updateData = $this->structureService->handle($server);
|
||||
|
||||
// Because Wings always fetches an updated configuration from the Panel when booting
|
||||
// a server this type of exception can be safely "ignored" and just written to the logs.
|
||||
// Ideally this request succeedes so we can apply resource modifications on the fly
|
||||
// but if it fails it isn't the end of the world.
|
||||
if (!empty($updateData['build'])) {
|
||||
$this->daemonServerRepository->setServer($server)->update([
|
||||
'build' => $updateData['build'],
|
||||
]);
|
||||
try {
|
||||
$this->daemonServerRepository->setServer($server)->update([
|
||||
'build' => $updateData['build'],
|
||||
]);
|
||||
} catch (DaemonConnectionException $exception) {
|
||||
Log::warning($exception, ['server_id' => $server->id]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->connection->commit();
|
||||
|
|
|
@ -74,7 +74,7 @@ class ToggleTwoFactorService
|
|||
$isValidToken = $this->google2FA->verifyKey($secret, $token, config()->get('pterodactyl.auth.2fa.window'));
|
||||
|
||||
if (!$isValidToken) {
|
||||
throw new TwoFactorAuthenticationTokenInvalid('The token provided is not valid.');
|
||||
throw new TwoFactorAuthenticationTokenInvalid();
|
||||
}
|
||||
|
||||
return $this->connection->transaction(function () use ($user, $toggleState) {
|
||||
|
@ -94,6 +94,9 @@ class ToggleTwoFactorService
|
|||
$inserts[] = [
|
||||
'user_id' => $user->id,
|
||||
'token' => password_hash($token, PASSWORD_DEFAULT),
|
||||
// insert() won't actually set the time on the models, so make sure we do this
|
||||
// manually here.
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
|
||||
$tokens[] = $token;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue