/**
  * Validate admin credentials.
  *
  * @return JsonModel
  */
 public function indexAction()
 {
     try {
         $content = $this->getRequest()->getContent();
         $source = $content ? $source = Json::decode($content, Json::TYPE_ARRAY) : [];
         $data = $this->requestDataConverter->convert($source);
         $this->adminCredentialsValidator->validate($data);
         return new JsonModel(['success' => true]);
     } catch (\Exception $e) {
         return new JsonModel(['success' => false, 'error' => $e->getMessage()]);
     }
 }
Beispiel #2
0
 /**
  * Index Action
  *
  * @return JsonModel
  */
 public function startAction()
 {
     $this->log->clear();
     $json = new JsonModel();
     try {
         $this->checkForPriorInstall();
         $content = $this->getRequest()->getContent();
         $source = $content ? $source = Json::decode($content, Json::TYPE_ARRAY) : [];
         $data = $this->requestDataConverter->convert($source);
         $this->installer->install($data);
         $json->setVariable('key', $this->installer->getInstallInfo()[SetupConfigOptionsList::KEY_ENCRYPTION_KEY]);
         $json->setVariable('success', true);
         if ($this->sampleDataState->hasError()) {
             $json->setVariable('isSampleDataError', true);
         }
         $json->setVariable('messages', $this->installer->getInstallInfo()[Installer::INFO_MESSAGE]);
     } catch (\Exception $e) {
         $this->log->logError($e);
         $json->setVariable('messages', $e->getMessage());
         $json->setVariable('success', false);
     }
     return $json;
 }