예제 #1
0
 function renderInstance($instanceId, $instanceConfig)
 {
     $config = $this->getServiceLocator()->get('config');
     $view = parent::renderInstance($instanceId, $instanceConfig);
     $view->setVariable('availableButtons', $config['rcmPlugin']['RcmSocialButtons']['availableButtons']);
     return $view;
 }
예제 #2
0
 public function renderInstance($instanceId, $instanceConfig)
 {
     $error = null;
     $username = null;
     $view = parent::renderInstance($instanceId, $instanceConfig);
     $view->setVariables(['error' => $error, 'username' => $username]);
     if (!$this->postIsForThisPlugin()) {
         return $view;
     }
     $user = $this->getUser();
     // Invalid User
     if (empty($user)) {
         $error = $instanceConfig['translate']['missing'];
         $view->setVariable('error', $error);
         return $view;
     }
     /** @var \Zend\Authentication\Result $authResult */
     $authResult = $this->rcmUserService->authenticate($user);
     // Valid auth
     if ($authResult->isValid()) {
         $parms = array('request' => $this->getRequest(), 'response' => $this->getResponse());
         $event = new Event('LoginSuccessEvent', $this, $parms);
         $eventManager = $this->getEventManager();
         $eventManager->trigger($event);
         return $this->getResponse();
     }
     // Invalid Auth
     if ($authResult->getCode() == Result::FAILURE_UNCATEGORIZED && !empty($this->config['rcmPlugin']['RcmLogin']['uncategorizedErrorRedirect'])) {
         return $this->redirect()->toUrl($this->config['rcmPlugin']['RcmLogin']['uncategorizedErrorRedirect']);
     }
     $error = $instanceConfig['translate']['invalid'];
     $view->setVariable('error', $error);
     return $view;
 }
 /**
  * Render the plugin
  *
  * @param int   $instanceId     Instance ID
  * @param array $instanceConfig Instance Config
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function renderInstance($instanceId, $instanceConfig)
 {
     $links = array();
     if (!empty($instanceConfig['links']) && is_array($instanceConfig['links'])) {
         foreach ($instanceConfig['links'] as $link) {
             $links[] = new NavLink($link);
         }
     }
     $this->checkLinks($links);
     $view = parent::renderInstance($instanceId, $instanceConfig);
     $view->setVariable('links', $links);
     $view->setVariable('isAdmin', $this->permissionChecks->siteAdminCheck($this->currentSite));
     return $view;
 }
 /**
  * Plugin Action - Returns the guest-facing view model for this plugin
  *
  * @param int $instanceId plugin instance id
  * @param array $instanceConfig Instance Config
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function renderInstance($instanceId, $instanceConfig)
 {
     $form = new ResetPasswordForm($instanceConfig);
     $error = null;
     $view = parent::renderInstance($instanceId, $instanceConfig);
     if ($this->params()->fromQuery('invalidLink')) {
         $error = 'The password reset link you used is invalid.' . ' It may be expired or have already been used. Please try again below.';
     }
     $view->setTemplate('rcm-reset-password/plugin');
     $view->setVariables(['form' => $form, 'postSuccess' => false, 'error' => $error]);
     if (!$this->postIsForThisPlugin()) {
         return $view;
     }
     // Handle Post
     $error = $this->handlePost($form, $instanceConfig);
     if (empty($error)) {
         $view->setVariable('postSuccess', true);
     }
     $view->setVariable('error', $error);
     return $view;
 }
예제 #5
0
 function __construct($config, EntityManager $entityMgr, \RcmEventCalenderCore\Model\Calender $calender)
 {
     parent::__construct($config);
     $this->calender = $calender;
 }
 /**
  * Plugin Action - Returns the guest-facing view model for this plugin
  *
  * @param int   $instanceId     plugin instance id
  * @param array $instanceConfig Instance Config
  *
  * @return \Zend\View\Model\ViewModel
  */
 public function renderInstance($instanceId, $instanceConfig)
 {
     $form = new CreateNewPasswordForm($instanceConfig);
     $postSuccess = false;
     $error = '';
     $hideForm = false;
     $passwordEntity = null;
     /** @var \Zend\Http\Request $request */
     $request = $this->getRequest();
     $key = $request->getQuery('key', null);
     if ($key) {
         /** @var \RcmLogin\Entity\ResetPassword $passwordEntity */
         $passwordEntity = $this->entityMgr->getRepository('RcmLogin\\Entity\\ResetPassword')->findOneBy(['hashKey' => $key]);
     }
     if (!$passwordEntity) {
         return $this->notAuthorized();
     }
     $createdDate = $passwordEntity->getCreatedDate();
     if (strtotime("now") - $createdDate->getTimeStamp() > 172800) {
         return $this->notAuthorized();
     }
     if ($this->postIsForThisPlugin()) {
         $error = $this->handlePost($form, $instanceConfig, $passwordEntity->getUserId());
         if (!$error) {
             $postSuccess = true;
             $this->entityMgr->remove($passwordEntity);
             $this->entityMgr->flush();
         }
     }
     $view = parent::renderInstance($instanceId, $instanceConfig);
     $view->setTemplate('rcm-create-new-password/plugin');
     $view->setVariables(['hideForm' => $hideForm, 'form' => $form, 'postSuccess' => $postSuccess, 'error' => $error]);
     return $view;
 }