add new exception for private playlists to prevent unauthorized access

This commit is contained in:
Apoorv Pal
2021-10-20 22:40:16 +05:30
parent 98c29c7d38
commit eef014373b
2 changed files with 48 additions and 2 deletions
+2 -2
View File
@@ -13,6 +13,7 @@
namespace App\Http\Controllers;
use App\Exceptions\PlaylistException;
use App\Helpers\Bencode;
use App\Models\Movie;
use App\Models\Playlist;
@@ -124,8 +125,7 @@ class PlaylistController extends Controller
if($playlist->is_private && $playlist->user->id != auth()->id())
{
echo "Private Playlist Not Accessible!";
return view('home.index');
throw new PlaylistException(100);
}
$random = PlaylistTorrent::where('playlist_id', '=', $playlist->id)->inRandomOrder()->first();