Esempio n. 1
0
 /**
  * First-time hosted activation page,
  * Adds the first admin, based on DF user authentication
  */
 public function actionActivate()
 {
     //        if ( $this->_activated )
     //        {
     //            $this->redirect( '/' );
     //        }
     $_model = new ActivateForm();
     if (isset($_POST, $_POST['ActivateForm'])) {
         $_model->attributes = $_POST['ActivateForm'];
         //	Validate user input and redirect to the previous page if valid
         if ($_model->validate() && $_model->activate()) {
             try {
                 Platform::setPlatformState('platform', FabricPlatformStates::ACTIVATED);
                 SystemManager::initAdmin();
                 $this->redirect($this->_getRedirectUrl());
                 return;
             } catch (\Exception $_ex) {
                 $_model->addError('username', $_ex->getMessage());
             }
         } else {
             $_model->addError('username', 'Invalid username and password combination.');
         }
     }
     $this->render('activate', array('model' => $_model, 'activated' => $this->_activated));
 }