2018-05-09 08:05:17 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2018-09-11 07:51:35 -05:00
|
|
|
use App\Models\Device;
|
2020-05-23 19:05:18 +02:00
|
|
|
use App\Providers\RouteServiceProvider;
|
2018-05-09 08:05:17 -05:00
|
|
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
2018-09-11 07:51:35 -05:00
|
|
|
use LibreNMS\Config;
|
2018-05-09 08:05:17 -05: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.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2020-05-23 19:05:18 +02:00
|
|
|
protected $redirectTo = RouteServiceProvider::HOME;
|
2018-05-09 08:05:17 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new controller instance.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->middleware('guest')->except('logout');
|
|
|
|
|
}
|
2018-09-11 07:51:35 -05:00
|
|
|
|
|
|
|
|
public function username()
|
|
|
|
|
{
|
|
|
|
|
return 'username';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function showLoginForm()
|
|
|
|
|
{
|
|
|
|
|
if (Config::get('public_status')) {
|
2019-08-19 22:52:21 -05:00
|
|
|
$devices = Device::isActive()->with('location')->get();
|
2018-09-11 07:51:35 -05:00
|
|
|
return view('auth.public-status')->with('devices', $devices);
|
|
|
|
|
}
|
|
|
|
|
return view('auth.login');
|
|
|
|
|
}
|
2018-05-09 08:05:17 -05:00
|
|
|
}
|