config = new AauthConfig();
$this->aauth = new Aauth();
$this->request = Services::request();
helper('form');
}
/**
* Index
*
* @return void
*/
public function index()
{
if ($input = $this->request->getPost())
{
$identifier = ($this->config->loginUseUsername ? $input['username'] : $input['email']);
if (! $this->aauth->login($identifier, $input['password'], (isset($input['remember']) ? true : false)))
{
$data['errors'] = $this->aauth->printErrors('
', true);
}
else
{
$this->response->redirect(site_url('/account'));
}
}
if (session('errors'))
{
$data['errors'] = isset($data['errors']) ? $data['errors'] . '
' . session('errors') : session('errors');
}
$data['useUsername'] = $this->config->loginUseUsername;
$data['cssFiles'] = [
'/assets/css/login.css'
];
echo view('Account/Login', $data);
}
}