stuff after login
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
//Library
|
||||
use App\Library\Contracts\ContractHelper;
|
||||
|
||||
@@ -23,6 +23,10 @@ class HaulingController extends Controller
|
||||
* Controller function to display form
|
||||
*/
|
||||
public function displayForm() {
|
||||
if(Auth::check()) {
|
||||
return redirect('/dashboard');
|
||||
}
|
||||
|
||||
return view('hauling.display.form');
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,7 @@ class Authenticate extends Middleware
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if($this->auth->check()) {
|
||||
return route('/');
|
||||
} else {
|
||||
return route('/');
|
||||
return route('/dashboard');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
44
app/Traits/EveOAuth.php
Normal file
44
app/Traits/EveOAuth.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
use Laravel\Socialite\Two\InvalidStateException;
|
||||
|
||||
trait EveOAuth {
|
||||
|
||||
protected $user;
|
||||
|
||||
public function login() {
|
||||
try {
|
||||
return Socialite::driver('eveonline')->redirect();
|
||||
} catch(Exception $e) {
|
||||
return back();
|
||||
}
|
||||
}
|
||||
|
||||
public function callback() {
|
||||
try {
|
||||
$this->user = Socialite::driver('eveonline')->user();
|
||||
} catch(InvalidStateException $e) {
|
||||
return back();
|
||||
}
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function get_character() {
|
||||
//Get more detailed character data from CREST
|
||||
$httpClient = new Client();
|
||||
$url = "https://esi.evetech.net/latest/characters/{$this->user->id}/?datasource=tranquility";
|
||||
try {
|
||||
$response = $httpClient->get($url);
|
||||
} catch (Exception $exception) {
|
||||
return abort(504, 'ESI is not reachable, try again late.');
|
||||
}
|
||||
return json_decode($response->getBody()->getContents());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -24,6 +24,7 @@ class CreateUsersTable extends Migration
|
||||
$table->integer('inserted_at')->default(0);
|
||||
$table->integer('expires_in')->default(0);
|
||||
$table->string('owner_hash');
|
||||
$table->string('remember_token')->nullable();
|
||||
$table->string('user_type')->default('Guest');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ Route::group(['middleware' => ['auth']], function(){
|
||||
/**
|
||||
* Dashboard Controller Display pages
|
||||
*/
|
||||
Route::get('/dashboard', 'Dashboard\DashboardController@index');
|
||||
Route::get('/dashboard', 'Dashboard\DashboardController@index')->name('/dashboard');
|
||||
//Route::get('/profile', 'Dashboard\DashboardController@profile');
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user