Beispiel #1
0
 public function loginStepTwoAction()
 {
     $account = Cible_FunctionsGeneral::getAuthentication();
     if (is_null($account)) {
         $path = Zend_Registry::get('web_root') . '/';
         setcookie('returnUrl', $this->view->selectedPage, 0, $path);
         $path = Zend_Registry::get('web_root') . '/';
         $url = $this->view->selectedPage . '/resume-order/';
         setcookie('returnUrl', $url, 0, $path);
         $form = new FormLogin();
         if ($this->_request->isPost() && array_key_exists('submit_login', $_POST)) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $result = Cible_FunctionsGeneral::authenticate($formData['email'], $formData['password']);
                 if ($result['success'] == 'true') {
                     $this->disableView();
                     $hash = md5(session_id());
                     $duration = $formData['stayOn'] ? time() + 60 * 60 * 24 * 365 : 0;
                     $cookie = array('lastName' => utf8_encode($result['lastName']), 'firstName' => utf8_encode($result['firstName']), 'email' => $result['email'], 'hash' => $hash);
                     setcookie("authentication", json_encode($cookie), $duration, $path);
                     $memberProfile = new MemberProfile();
                     $memberProfile->updateMember($result['member_id'], array('hash' => $hash));
                     $this->_redirect($url);
                 } else {
                     $error = Cible_Translation::getClientText('login_form_auth_fail_error');
                     $this->view->assign('error', $error);
                 }
             }
         }
         $this->view->assign('form', $form);
     }
 }