/**
  * Accepts an email and password, attempts to log user in
  * and create a session. Returns a session ID.
  */
 public function loginAction()
 {
     $email = $this->request->getPost('email');
     $password = $this->request->getPost('password');
     // try to log in with credentials
     //
     $this->redirect = 'dashboard';
     $action = new \Actions\Users\Auth();
     $loggedIn = $action->login(array('email' => $email, 'password' => $password));
     if (!$loggedIn) {
         $this->redirect = 'login';
     }
 }
 /**
  * Accepts an email and password, attempts to log user in
  * and create a session. Returns a session ID.
  */
 public function loginAction()
 {
     $email = $this->request->getPost('email');
     $password = $this->request->getPost('password');
     // try to log in with credentials
     //
     $action = new \Actions\Users\Auth();
     $loggedIn = $action->login(array('email' => $email, 'password' => $password));
     if (!$loggedIn) {
         $this->setStatus(ERROR);
         return FALSE;
     }
     $this->data->user_id = $this->auth->getUserId();
     $this->data->session_id = $this->session->getId();
 }
 /**
  * @group actions
  * @group users
  * @group auth
  */
 public function testCorrectLoginCredentials()
 {
     $util = $this->di->get('util');
     $action = new \Actions\Users\Auth();
     $params = array('email' => '*****@*****.**', 'password' => 'password');
     $this->assertCount(0, $util->getMessages());
     $this->assertTrue($action->login($params));
     $this->assertCount(0, $util->getMessages());
     $session = $this->di->get('session');
     $this->assertTrue(valid($session->get('user_id')));
 }