2016-09-01 16:23:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
|
2016-09-02 10:42:05 +01:00
|
|
|
use App\Facade\Theme;
|
2016-09-01 16:23:39 +01:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
2016-09-06 12:23:14 +01:00
|
|
|
use Illuminate\Http\Request;
|
2016-09-01 16:23:39 +01: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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Where to redirect users after login / registration.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $redirectTo = '/';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('guest', ['except' => 'logout']);
|
|
|
|
}
|
2016-09-02 10:42:05 +01:00
|
|
|
|
2016-09-06 12:23:14 +01:00
|
|
|
protected function credentials(Request $request)
|
|
|
|
{
|
|
|
|
$result = $request->only($this->username(), 'password');
|
|
|
|
|
|
|
|
// Only allow activated users to login
|
|
|
|
$result['is_activated'] = true;
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2016-09-02 10:42:05 +01:00
|
|
|
/**
|
|
|
|
* Show the application's login form.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
2016-09-06 14:45:51 +01:00
|
|
|
public function showLoginForm(Request $request)
|
2016-09-02 10:42:05 +01:00
|
|
|
{
|
2016-09-06 14:45:51 +01:00
|
|
|
return Theme::render('auth.login', [
|
|
|
|
'info' => $request->session()->get('info')
|
|
|
|
]);
|
2016-09-02 10:42:05 +01:00
|
|
|
}
|
2016-09-01 16:23:39 +01:00
|
|
|
}
|