From b67813b2602ad53bae24d16a77d3a1fed9d3b0c2 Mon Sep 17 00:00:00 2001 From: Dominic Fitch-Jones Date: Sun, 2 Oct 2016 21:27:25 -0400 Subject: [PATCH] Make sure that you can't delete your own account. (#110) --- app/Repositories/UserRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 47cf78f66..b9d943b08 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -30,6 +30,7 @@ use Hash; use Validator; use Mail; use Carbon; +use Auth; use Pterodactyl\Models; use Pterodactyl\Services\UuidService; @@ -152,6 +153,10 @@ class UserRepository throw new DisplayException('Cannot delete a user with active servers attached to thier account.'); } + if(Auth::user()->id === $id) { + throw new DisplayException('Cannot delete your own account.'); + } + DB::beginTransaction(); try {