request->isPost()) {
$data = $this->request->getPost();
if ($form->isValid($data)) {
$email = $form->getValue('Email');
$passwd = $form->getValue('Password');
// Perform login
if ($this->auth->login($email, $passwd)) {
$this->response->redirect('/');
} else {
$this->flash->message('error', "Invalid credentials");
}
} else {
$msg = '
';
foreach($form->getMessages() as $message) {
$msg .= '- ' . $message->getField() . ' '. $message->getMessage() . '
';
}
$msg .= '
';
$this->flash->message('error', $msg);
}
}
$this->view->form = $form;
}
public function oauthAction()
{
$response = $this->oauth->perform();
if (is_array($response)) {
$this->auth->loginOauth($response['auth']);
}
$this->response->redirect('/');
}
public function logoutAction()
{
$this->auth->clearIdentity();
$this->response->redirect('/');
}
}