mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
fixes bug that would allow deleting the default allocation for a server.
This commit is contained in:
parent
0a481b325c
commit
0b044b3cc6
@ -537,12 +537,12 @@ class ServerRepository
|
||||
list($ip, $port) = explode(':', $combo);
|
||||
// Invalid, not worth killing the whole thing, we'll just skip over it.
|
||||
if (!filter_var($ip, FILTER_VALIDATE_IP) || !preg_match('/^(\d{1,5})$/', $port)) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// Can't remove the assigned IP/Port combo
|
||||
if ($ip === $allocation->ip && $port === $allocation->port) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
Models\Allocation::where('ip', $ip)->where('port', $port)->where('assigned_to', $server->id)->update([
|
||||
@ -558,12 +558,12 @@ class ServerRepository
|
||||
list($ip, $port) = explode(':', $combo);
|
||||
// Invalid, not worth killing the whole thing, we'll just skip over it.
|
||||
if (!filter_var($ip, FILTER_VALIDATE_IP) || !preg_match('/^(\d{1,5})$/', $port)) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// Don't allow double port assignments
|
||||
if (Models\Allocation::where('port', $port)->where('assigned_to', $server->id)->count() !== 0) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
Models\Allocation::where('ip', $ip)->where('port', $port)->whereNull('assigned_to')->update([
|
||||
|
@ -285,7 +285,7 @@
|
||||
<div>
|
||||
<select name="remove_additional[]" class="form-control" multiple>
|
||||
@foreach ($assigned as $assignment)
|
||||
<option value="{{ $assignment->ip }}:{{ $assignment->port }}">@if(!is_null($assignment->ip_alias)){{ $assignment->ip_alias }}@else{{ $assignment->ip }}@endif:{{ $assignment->port }} @if(!is_null($assignment->ip_alias))(alias of {{ $assignment->ip }})@endif</option>
|
||||
<option value="{{ $assignment->ip }}:{{ $assignment->port }}" @if($server->allocation === $assignment->id)disabled @endif>@if(!is_null($assignment->ip_alias)){{ $assignment->ip_alias }}@else{{ $assignment->ip }}@endif:{{ $assignment->port }} @if(!is_null($assignment->ip_alias))(alias of {{ $assignment->ip }})@endif</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user