/** * passwordResetRequestAction * @return \Zend\Stdlib\ResponseInterface tags */ public function passwordResetRequestAction() { $browserTabId = $this->params()->fromPost('browserTabId', null); $token = $this->params()->fromPost('token', null); $username = $this->params()->fromPost('user', null); $password = $this->params()->fromPost('password', null); if ($browserTabId and $token and $username and $password) { // message to update password // if the update fails a platform exception is caught and user informed $message = new Message(array('env' => getenv('APPLICATION_ENV'), 'inst' => getenv('APPLICATION_INSTANCE'))); $session = $this->getServiceLocator()->get('Zend\\Session\\SessionManager'); $data = array('username' => $username, 'password' => $password, 'token' => $token); $resetId = $message->addAction('movein', 'resetPassowrd', $data, 'MoveIn4User\\Model\\User'); // add message for failed token $data = array('channel' => array('session_' . $session->getId()), 'message' => 'message_invalid_credentials', 'jsFunction' => 'failedToken', 'jsClass' => 'login'); $message->addErrorhandler('response', 'send', $data, 'SocketResponse', array('parentId' => $resetId, 'errorCode' => 'passwordTokenInvalid')); // add message for sucessful token $data = array('channel' => array('tab_' . $browserTabId), 'message' => array('status' => true), 'jsFunction' => 'passwordUpdated', 'jsClass' => 'login'); $message->addAction('response', 'send', $data, 'SocketResponse'); $router = $this->getServiceLocator()->get('platform-router'); $router->queue($message->asXml()); } $response = $this->getResponse(); $response->setStatusCode(200); $response->setContent('done'); return $response; }