Apply fixes from StyleCI
This commit is contained in:
parent
a1d3bbf73d
commit
c1fb0a665f
150 changed files with 1558 additions and 1760 deletions
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>
|
||||
* Some Modifications (c) 2015 Dylan Seidt <dylan.seidt@gmail.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -22,19 +22,17 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Base;
|
||||
|
||||
use Google2FA;
|
||||
use Alert;
|
||||
|
||||
use Google2FA;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\Session;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SecurityController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns Security Management Page.
|
||||
*
|
||||
|
@ -44,7 +42,7 @@ class SecurityController extends Controller
|
|||
public function index(Request $request)
|
||||
{
|
||||
return view('base.security', [
|
||||
'sessions' => Session::where('user_id', $request->user()->id)->get()
|
||||
'sessions' => Session::where('user_id', $request->user()->id)->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -57,7 +55,6 @@ class SecurityController extends Controller
|
|||
*/
|
||||
public function generateTotp(Request $request)
|
||||
{
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
$user->totp_secret = Google2FA::generateSecretKey();
|
||||
|
@ -69,9 +66,8 @@ class SecurityController extends Controller
|
|||
$user->email,
|
||||
$user->totp_secret
|
||||
),
|
||||
'secret' => $user->totp_secret
|
||||
'secret' => $user->totp_secret,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,18 +78,16 @@ class SecurityController extends Controller
|
|||
*/
|
||||
public function setTotp(Request $request)
|
||||
{
|
||||
|
||||
if (!$request->has('token')) {
|
||||
if (! $request->has('token')) {
|
||||
return response(null, 500);
|
||||
}
|
||||
|
||||
$user = $request->user();
|
||||
if($user->toggleTotp($request->input('token'))) {
|
||||
if ($user->toggleTotp($request->input('token'))) {
|
||||
return response('true');
|
||||
}
|
||||
|
||||
return response('false');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,27 +98,27 @@ class SecurityController extends Controller
|
|||
*/
|
||||
public function disableTotp(Request $request)
|
||||
{
|
||||
|
||||
if (!$request->has('token')) {
|
||||
if (! $request->has('token')) {
|
||||
Alert::danger('Missing required `token` field in request.')->flash();
|
||||
|
||||
return redirect()->route('account.totp');
|
||||
}
|
||||
|
||||
$user = $request->user();
|
||||
if($user->toggleTotp($request->input('token'))) {
|
||||
if ($user->toggleTotp($request->input('token'))) {
|
||||
return redirect()->route('account.security');
|
||||
}
|
||||
|
||||
Alert::danger('The TOTP token provided was invalid.')->flash();
|
||||
return redirect()->route('account.security');
|
||||
|
||||
return redirect()->route('account.security');
|
||||
}
|
||||
|
||||
public function revoke(Request $request, $id)
|
||||
{
|
||||
$session = Session::where('id', $id)->where('user_id', $request->user()->id)->firstOrFail();
|
||||
$session->delete();
|
||||
|
||||
return redirect()->route('account.security');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue