the browser-facing portion of osu!
at master 916 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\Middleware; 7 8class VerifyUserAlways extends VerifyUser 9{ 10 const GET_ACTION_METHODS = [ 11 'GET' => true, 12 'HEAD' => true, 13 'OPTIONS' => true, 14 ]; 15 16 public static function isRequired($user) 17 { 18 return $user !== null && ($user->isPrivileged() || $user->isInactive()); 19 } 20 21 public function requiresVerification($request) 22 { 23 $method = $request->getMethod(); 24 $isPostAction = $GLOBALS['cfg']['osu']['user']['post_action_verification'] 25 ? !isset(static::GET_ACTION_METHODS[$method]) 26 : false; 27 28 $isRequired = $isPostAction || $method === 'DELETE' || session()->get('requires_verification'); 29 30 return $isRequired; 31 } 32}