npm update

This commit is contained in:
2026-02-21 21:12:46 -06:00
parent cd247a22b5
commit 47c85f31e7
23 changed files with 3432 additions and 170 deletions
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}
+21 -154
View File
@@ -3,171 +3,38 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
//Internal Library
use App\Library\Login\LoginHelper;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
*
* @var string
*/
protected $redirectto = '/dashboard';
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
*
* @return void
*/
public function __construct() {
$this->middleware('guest')->except(['logout',
'handleProviderCallback',
'redirectToProvider']);
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->middleware('auth')->only('logout');
}
/**
* Logout function
*
* @return void
*/
public function logout() {
Auth::logout();
return redirect('/');
}
/**
* Redirect to provider's website
*
* @return param
*/
public function redirectToEveonline() {
return Socialite::driver('eveonline')->scopes(['publicData'])->redirect();
}
/**
* Create a new controller instance
*
* @return void
*/
public function handleEveonlineCallback() {
try {
$user = Socialite::driver('eveonline')->user();
$findUser = User::where('character_id', $user->character_id)->first();
if($findUser) {
Auth::login($finduser);
return redirect()->intended('home');
} else {
$newUser = User::updateOrCreate(['character_id' => $user->character_id], [
'character_name' => $user->character_name,
'character_id' => $user->character_id,
'token' => $user->token,
'refresh_token' => $user->refresh_token,
'expiresIn' => $user->expiresIn,
'user_jwt_token' => $user->user,
]);
Auth::login($newUser);
return redirect()->intended('home');
}
} catch(Exception $e) {
dd($e->getMessage());
}
}
/**
* Redirect to the provider's website
*
* @return Socialite
* @return character_owner_hash
* @return character_name
* @return character_id
* @return token
* @return refreshToken
* @return expiresIn
* @return user (Holds jwt)
*/
public function redirectToProvider_old() {
//The default scope is public data for everyone due to OAuth2 Tokens
//Add esi-mail.send_mail.v1 to send mails more efficiently
$scopes = ['publicData', 'esi-mail.send_mail.v1'];
//Collect any other scopes from the database.
//If we are logged in we are linking another character to this one.
//Attempt to use the same scopes for this character as the original.
if(Auth::check()) {
$extrascopes = EsiScope::where([
'character_id' => auth()->user()->getId();
])->get(['scope']);
//Pop each scope onto the array of scopes
foreach($extraScopes as $extra) {
array_push($scopes, $extra->scope);
}
/**
* Place the scopes in the session.
* Place the original character id in the session.
*/
session()->put('scopes', $scopes);
session()->put('orgCharacter', auth()->user()->getId());
}
return Socialite::driver('eveonline')->scopes($scopes)->redirect();
}
/**
* Get token from callback
* Redirect to the dashboard if logging in successfully.
*
* @return redirect()
*/
public function handleProviderCallback(Socialite $social) {
//Get the sso user from the socialite driver
$ssoUser = $social->driver('eveonline')->user();
$scpSession = session()->pull('scopes');
//If the user was already logged in, let's do some checks to see if we are adding
//additional scopes to the user's account
if(Auth::check()) {
//If we are logged in already and the session contains the original characters, then we are creating an alt
//for the original character
if(session()->has('orgCharacter')) {
$orgCharacter = session()->pull('orgCharacter');
if(LoginHelper::createAlt($ssoUser, $orgCharacter)) {
return redirect()->to('/profile')->with('success', 'Alt registered.');
} else {
return redirect()->to('/profile')->with('error', 'Unable to register alt or it was previously registered.');
}
} else {
if(sizeof($ssoUser->scopes) > 1) {
$tokenCount = EsiToken::where([
'character_id' => $ssoUser->id,
])->count();
if($tokenCount > 0) {
LoginHelper::UpdateEsiToken($ssoUser);
} else {
LoginHelper::SaveEsiToken($ssoUser);
}
LoginHelper::SetScopes($ssoUser->scopes, $ssoUser->id);
return redirect()->to('/dashboard')->with('success', 'Successfully updated ESI scopes.');
}
}
} else {
//If the user wasn't logged in, then create a new user
$user = LoginHelper::createOrGetUser($ssoUser);
//Login in the new user
auth()->login($user, true);
//Redirect back to the dashboard
return redirect()->to('/dashboard')->with('success', 'Successfully Logged In.');
}
}
}
@@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}
@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}
@@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}