the browser-facing portion of osu!
at master 935 B view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Http\Controllers\Account; 7 8use App\Http\Controllers\Controller; 9use App\Libraries\Session\Store as SessionStore; 10 11class SessionsController extends Controller 12{ 13 public function __construct() 14 { 15 $this->middleware('auth'); 16 $this->middleware('verify-user'); 17 18 parent::__construct(); 19 } 20 21 public function destroy($id) 22 { 23 if (\Session::getId() === $id) { 24 // current session 25 logout(); 26 } else { 27 $session = SessionStore::findOrNew($id); 28 if ($session->userId() === \Auth::user()->getKey()) { 29 $session->delete(); 30 } else { 31 abort(404); 32 } 33 } 34 35 return response([], 204); 36 } 37}