diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index fedb723..2edd555 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -145,6 +145,13 @@ class ProfileController extends Controller { $user = $request->user(); + // Verify password if user has password + if (!is_null($user->password)) { + $request->validateWithBag('userDeletion', [ + 'password' => ['required', 'current_password'], + ]); + } + // Delete Playlist $playlists = Playlist::where('user_id', $user->id)->get(); foreach($playlists as $playlist) { @@ -155,6 +162,11 @@ class ProfileController extends Controller // Update comments to deleted user DB::table('comments')->where('commenter_id', '=', $user->id)->update(['commenter_id' => 1]); + // Delete Profile Picture + if ($user->avatar) { + Storage::disk('public')->delete($user->avatar); + } + Auth::logout(); $user->forceDelete(); diff --git a/resources/views/components/modal.blade.php b/resources/views/components/modal.blade.php index 384662a..568d7d2 100644 --- a/resources/views/components/modal.blade.php +++ b/resources/views/components/modal.blade.php @@ -46,7 +46,7 @@ $maxWidth = [ x-on:keydown.tab.prevent="$event.shiftKey || nextFocusable().focus()" x-on:keydown.shift.tab.prevent="prevFocusable().focus()" x-show="show" - class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50" + class="fixed inset-0 overflow-y-auto px-4 py-12 sm:px-0 z-50" style="display: {{ $show ? 'block' : 'none' }};" >