Skip to content

Commit 245f8e8

Browse files
authored
Merge branch '0.7-develop' into api-fixes
2 parents 5f60a6c + c377be2 commit 245f8e8

File tree

7 files changed

+26
-18
lines changed

7 files changed

+26
-18
lines changed

app/Http/Controllers/Admin/DatabaseController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function create(DatabaseHostFormRequest $request): RedirectResponse
131131
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
132132
)->flash();
133133

134-
redirect()->route('admin.databases')->withInput($request->validated());
134+
return redirect()->route('admin.databases')->withInput($request->validated());
135135
} else {
136136
throw $exception;
137137
}
@@ -165,7 +165,7 @@ public function update(DatabaseHostFormRequest $request, DatabaseHost $host): Re
165165
$this->alert->danger(
166166
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
167167
)->flash();
168-
$redirect->withInput($request->normalize());
168+
return $redirect->withInput($request->normalize());
169169
} else {
170170
throw $exception;
171171
}

app/Http/Controllers/Auth/LoginController.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class LoginController extends Controller
2020
{
2121
use AuthenticatesUsers;
2222

23-
const USER_INPUT_FIELD = 'user';
24-
2523
/**
2624
* @var \Illuminate\Auth\AuthManager
2725
*/
@@ -64,14 +62,14 @@ class LoginController extends Controller
6462
*
6563
* @var int
6664
*/
67-
protected $lockoutTime;
65+
protected $decayMinutes;
6866

6967
/**
7068
* After how many attempts should logins be throttled and locked.
7169
*
7270
* @var int
7371
*/
74-
protected $maxLoginAttempts;
72+
protected $maxAttempts;
7573

7674
/**
7775
* LoginController constructor.
@@ -98,8 +96,8 @@ public function __construct(
9896
$this->google2FA = $google2FA;
9997
$this->repository = $repository;
10098

101-
$this->lockoutTime = $this->config->get('auth.lockout.time');
102-
$this->maxLoginAttempts = $this->config->get('auth.lockout.attempts');
99+
$this->decayMinutes = $this->config->get('auth.lockout.time');
100+
$this->maxAttempts = $this->config->get('auth.lockout.attempts');
103101
}
104102

105103
/**
@@ -112,7 +110,7 @@ public function __construct(
112110
*/
113111
public function login(Request $request)
114112
{
115-
$username = $request->input(self::USER_INPUT_FIELD);
113+
$username = $request->input($this->username());
116114
$useColumn = $this->getField($username);
117115

118116
if ($this->hasTooManyLoginAttempts($request)) {
@@ -209,20 +207,30 @@ protected function sendFailedLoginResponse(Request $request, Authenticatable $us
209207
{
210208
$this->incrementLoginAttempts($request);
211209
$this->fireFailedLoginEvent($user, [
212-
$this->getField($request->input(self::USER_INPUT_FIELD)) => $request->input(self::USER_INPUT_FIELD),
210+
$this->getField($request->input($this->username())) => $request->input($this->username()),
213211
]);
214212

215-
$errors = [self::USER_INPUT_FIELD => trans('auth.failed')];
213+
$errors = [$this->username() => trans('auth.failed')];
216214

217215
if ($request->expectsJson()) {
218216
return response()->json($errors, 422);
219217
}
220218

221219
return redirect()->route('auth.login')
222-
->withInput($request->only(self::USER_INPUT_FIELD))
220+
->withInput($request->only($this->username()))
223221
->withErrors($errors);
224222
}
225223

224+
/**
225+
* Get the login username to be used by the controller.
226+
*
227+
* @return string
228+
*/
229+
public function username()
230+
{
231+
return 'user';
232+
}
233+
226234
/**
227235
* Determine if the user is logging in using an email or username,.
228236
*

app/Services/Nests/NestDeletionService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle(int $nest): int
5151
{
5252
$count = $this->serverRepository->findCountWhere([['nest_id', '=', $nest]]);
5353
if ($count > 0) {
54-
throw new HasActiveServersException(trans('exceptions.service.delete_has_servers'));
54+
throw new HasActiveServersException(trans('exceptions.nest.delete_has_servers'));
5555
}
5656

5757
return $this->repository->delete($nest);

config/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
|
1313
*/
1414
'lockout' => [
15-
'time' => 120,
15+
'time' => 2,
1616
'attempts' => 3,
1717
],
1818

resources/themes/pterodactyl/admin/nodes/new.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
</div>
107107
<div class="box-body">
108108
<div class="row">
109-
<div class="form-group col-xs-12">
109+
<div class="form-group col-md-6">
110110
<label for="pDaemonBase" class="form-label">Daemon Server File Directory</label>
111111
<input type="text" name="daemonBase" id="pDaemonBase" class="form-control" value="/srv/daemon-data" />
112112
<p class="text-muted small">Enter the directory where server files should be stored. <strong>If you use OVH you should check your partition scheme. You may need to use <code>/home/daemon-data</code> to have enough space.</strong></p>
@@ -177,4 +177,4 @@
177177
<script>
178178
$('#pLocationId').select2();
179179
</script>
180-
@endsection
180+
@endsection

resources/themes/pterodactyl/server/files/list.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
<td data-identifier="name" data-name="{{ rawurlencode($file['entry']) }}" data-path="@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}@endif/">
142142
@if(in_array($file['mime'], $editableMime))
143143
@can('edit-files', $server)
144-
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ rawurlencode($file['directory']) }}/@endif{{ rawurlencode($file['entry']) }}" class="edit_file">{{ $file['entry'] }}</a>
144+
<a href="/server/{{ $server->uuidShort }}/files/edit/@if($file['directory'] !== ''){{ $file['directory'] }}/@endif{{ $file['entry'] }}" class="edit_file">{{ $file['entry'] }}</a>
145145
@else
146146
{{ $file['entry'] }}
147147
@endcan

tests/Unit/Services/Nests/NestDeletionServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testExceptionIsThrownIfServersAreAttached(int $count)
7373
$this->service->handle(1);
7474
} catch (PterodactylException $exception) {
7575
$this->assertInstanceOf(HasActiveServersException::class, $exception);
76-
$this->assertEquals(trans('exceptions.service.delete_has_servers'), $exception->getMessage());
76+
$this->assertEquals(trans('exceptions.nest.delete_has_servers'), $exception->getMessage());
7777
}
7878
}
7979

0 commit comments

Comments
 (0)