Skip to content

Commit 32b639e

Browse files
committed
Return a 404 if attempting to delete a user that does not exist; closes pterodactyl#503
1 parent 30e0495 commit 32b639e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/Repositories/UserRepository.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public function update($id, array $data)
151151
*/
152152
public function delete($id)
153153
{
154+
$user = Models\User::findOrFail($id);
155+
154156
if (Models\Server::where('owner_id', $id)->count() > 0) {
155157
throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
156158
}
@@ -170,7 +172,7 @@ public function delete($id)
170172
$subuser->delete();
171173
}
172174

173-
Models\User::destroy($id);
175+
$user->delete();
174176
DB::commit();
175177
} catch (\Exception $ex) {
176178
DB::rollBack();

0 commit comments

Comments
 (0)