Files
librenms-librenms/app/Http/Controllers/Auth/LoginController.php
Tony Murray d3243bd32e Fix public status location (#10526)
* Fix public status location
Implementing __toString() seemed to be the most elegant way to fix it.
Added pre-loading for locations too

* Take advantage of new __toString function
2019-08-19 22:52:21 -05:00

56 lines
1.3 KiB
PHP

<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\Device;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use LibreNMS\Config;
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 = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function username()
{
return 'username';
}
public function showLoginForm()
{
if (Config::get('public_status')) {
$devices = Device::isActive()->with('location')->get();
return view('auth.public-status')->with('devices', $devices);
}
return view('auth.login');
}
}