1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/Controllers/Auth/LoginController.php

61 lines
1.5 KiB
PHP
Raw Normal View History

2018-10-04 19:10:43 +02:00
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Utils\Traits\UserSessionAttributes;
2018-10-04 19:10:43 +02:00
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Laravel\Socialite\Facades\Socialite;
use Illuminate\Http\Request;
2018-10-04 19:10:43 +02:00
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;
use UserSessionAttributes;
2018-10-04 19:10:43 +02:00
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/dashboard';
2018-10-04 19:10:43 +02:00
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest:user')->except('logout');
2018-10-04 19:10:43 +02:00
}
public function authenticated(Request $request, $user)
{
$this->setCurrentCompanyId($user->companies()->first()->account->default_company_id);
}
public function redirectToProvider($provider)
{
return Socialite::driver($provider)->redirect();
}
public function handleProviderCallback($provider)
{
$user = Socialite::driver('github')->user();
dd($user);
}
2018-10-04 19:10:43 +02:00
}