%PDF- %PDF-
| Direktori : /home/graphicd/public_html/vebto/common/Auth/Controllers/ |
| Current File : /home/graphicd/public_html/vebto/common/Auth/Controllers/LoginController.php |
<?php namespace Common\Auth\Controllers;
use App\User;
use Auth;
use Common\Core\BaseController;
use Common\Core\Bootstrap\BootstrapData;
use Common\Settings\Settings;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
class LoginController extends BaseController
{
use AuthenticatesUsers;
/**
* @var BootstrapData
*/
private $bootstrapData;
/**
* @var Settings
*/
private $settings;
/**
* @param BootstrapData $bootstrapData
* @param Settings $settings
*/
public function __construct(BootstrapData $bootstrapData, Settings $settings)
{
$this->middleware('guest', ['except' => 'logout']);
$this->bootstrapData = $bootstrapData;
$this->settings = $settings;
}
protected function validateLogin(Request $request)
{
$this->validate($request, [
$this->username() => 'required|string|email_verified',
'password' => 'required|string',
]);
}
protected function authenticated(Request $request, User $user)
{
if ($this->settings->get('single_device_login')) {
Auth::logoutOtherDevices($request->get('password'));
}
$data = $this->bootstrapData->init()->getEncoded();
return $this->success(['data' => $data]);
}
}