Initial Commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
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';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
public function logout(Request $request) {
|
||||
Auth::logout();
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
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 = '/dashboard';
|
||||
|
||||
/**
|
||||
* 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:6|confirmed',
|
||||
'characterid' => 'required|string',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
'character_id' => $data['characterid'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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 = '/dashboard';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\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 resent if the user did not receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/dashboard';
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
//use Laravel\Socialite\Contracts\Factory as Socialite;
|
||||
//use Laravel\Socialite\Two\User as SocialiteUser;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Socialite;
|
||||
//use SocialiteUser;
|
||||
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Redirect the user to the Eve Online authentication page.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function redirectToProvider() {
|
||||
return Socialite::driver('eveonline')->redirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the user information from Eve Online
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handleProviderCallback(Socialite $social) {
|
||||
$user = $social->driver('eveonline')->user();
|
||||
Auth::login($user);
|
||||
dd($user);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Library;
|
||||
//use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
//use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('dashboard');
|
||||
}
|
||||
|
||||
public function addMoon() {
|
||||
return view('dashboard.addmoon');
|
||||
}
|
||||
|
||||
public function profile() {
|
||||
/**
|
||||
* Check to see if the user has a valid esi token
|
||||
*/
|
||||
$user = Auth::user();
|
||||
//Try to find the user's ESI token.
|
||||
$token = DB::table('esitokens')->where('CharacterId', $user['character_id'])->first();
|
||||
if($token != null) {
|
||||
$html = '<h3>ESI Token Already Stored</h3>';
|
||||
} else {
|
||||
//Setup the display button if the user doesn't have an ESI registered
|
||||
$state = uniqid();
|
||||
session(['state' => $state]);
|
||||
$esiLogin = new \App\Library\EsiLogin();
|
||||
$html = $esiLogin->DisplayLoginButton($state);
|
||||
}
|
||||
|
||||
|
||||
return view('dashboard.profile')->with('html', $html);
|
||||
}
|
||||
|
||||
public function callback(Request $request) {
|
||||
$esiLogin = new \App\Library\EsiLogin();
|
||||
//Pull the old session state from the session, and delete the key
|
||||
$oldState = $request->session()->pull('state');
|
||||
//Check the state to make sure it matches
|
||||
if($oldState == $request->input('state')) {
|
||||
$esiLogin->RetrieveAccessToken();
|
||||
$esiLogin->RetrieveCharacterId();
|
||||
//Store the token in the database
|
||||
$token = new \App\EsiToken;
|
||||
$token->CharacterId = $esiLogin->GetCharacterId();
|
||||
$token->AccessToken = $esiLogin->GetAccessToken();
|
||||
$token->RefreshToken = $esiLogin->GetRefreshToken();
|
||||
$token->ExpiresIn = $esiLogin->GetRefreskTokenExpiry();
|
||||
$token->save();
|
||||
//Return view back to profile with success message
|
||||
return view('dashboard')->with('message', 'Success!');
|
||||
} else {
|
||||
//Return view with error message back to the dashboard
|
||||
return view('dashboard')->with('message', 'Error!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function displayMoons() {
|
||||
$moons = DB::table('moons')->get();
|
||||
|
||||
return 'Moons Display Table';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Moon;
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class MoonsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Add a new moon into the database
|
||||
*
|
||||
* @return \Illuminate\Http\Reponse
|
||||
*/
|
||||
public function addMoon(Request $request) {
|
||||
$this->validate($request, [
|
||||
'region' => 'required',
|
||||
'system' => 'required',
|
||||
'structure' => 'required',
|
||||
|
||||
]);
|
||||
|
||||
// Add new moon
|
||||
$moon = new Moon;
|
||||
$moon->Region = $request->input('region');
|
||||
$moon->System = $request->input('system');
|
||||
$moon->StructureName = $request->input('structure');
|
||||
$moon->FirstOre = $request->input('firstore');
|
||||
$moon->FirstQuantity = $request->input('firstquan');
|
||||
$moon->SecondOre = $request->input('secondore');
|
||||
$moon->SecondQuantity = $request->input('secondquan');
|
||||
$moon->ThirdOre = $request->input('thirdore');
|
||||
$moon->ThirdQuantity = $request->input('thirdquan');
|
||||
$moon->FourthOre = $request->input('fourthore');
|
||||
$moon->FourthQuantity = $request->input('fourthquan');
|
||||
$moon->save();
|
||||
|
||||
return redirect('/dashboard')->with('success', 'Moon Added');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view with a table select for all of the structures in the corp owned by the player
|
||||
*/
|
||||
public function moonminedisplay() {
|
||||
// Disable all caching by setting the NullCache as the
|
||||
// preferred cache handler. By default, Eseye will use the
|
||||
// FileCache.
|
||||
$configuration = Configuration::getInstance();
|
||||
$configuration->cache = NullCache::class;
|
||||
|
||||
/**
|
||||
* Create the auth user space.
|
||||
* Get the character Id.
|
||||
* Check the character id against the esi token table
|
||||
* If the refresh token is available then request an ESI pull
|
||||
* If the refresh token is not available, display an error message
|
||||
*/
|
||||
$user = Auth::user();
|
||||
$characterId = $user->getCharacterId();
|
||||
|
||||
// Prepare an authentication container for ESI
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => env('ESI_CLIENT_ID'),
|
||||
'secret' => env('ESI_SECRET_KEY'),
|
||||
'refresh_token' => null,
|
||||
]);
|
||||
|
||||
// Instantiate a new ESI instance.
|
||||
$esi = new Eseye($authentication);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user