function changeemailAction()
 {
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     if (!isArrayKeyAnEmptyString('actkey', $formvalues) && !isArrayKeyAnEmptyString('ref', $formvalues)) {
         $newemail = decode($formvalues['ref']);
         $user = new UserAccount();
         $user->populate(decode($formvalues['id']));
         $oldemail = $user->getEmail();
         # validate the activation code
         if ($formvalues['actkey'] != $user->getActivationKey()) {
             $session->setVar(ERROR_MESSAGE, "Invalid activation code specified for email activation");
             $failureurl = $this->view->baseUrl('profile/view/id/' . encode($user->getID()));
             $this->_helper->redirector->gotoUrl($failureurl);
         }
         $user->setActivationKey('');
         $user->setEmail($newemail);
         $user->setEmail2('');
         $user->save();
         $view = new Zend_View();
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.12';
         $module = '1';
         $type = USER_CHANGE_EMAIL_CONFIRM;
         $details = "New Email (" . $user->getEmail() . ") activated for <a href='" . $url . "' class='blockanchor'>" . $user->getName() . "</a>";
         $browser = new Browser();
         $audit_values = $session->getVar('browseraudit');
         $audit_values['module'] = $module;
         $audit_values['usecase'] = $usecase;
         $audit_values['transactiontype'] = $type;
         $audit_values['userid'] = $session->getVar('userid');
         $audit_values['url'] = $url;
         $audit_values['transactiondetails'] = $details;
         $audit_values['status'] = "Y";
         // debugMessage($audit_values);
         $this->notify(new sfEvent($this, $type, $audit_values));
         $successmessage = "Successfully updated. Please note that you can no longer login using your previous Email Address";
         $session->setVar(SUCCESS_MESSAGE, $successmessage);
         $this->_helper->redirector->gotoUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
     }
 }
Exemplo n.º 2
0
 public function resetpasswordAction()
 {
     $session = SessionWrapper::getInstance();
     $user = new UserAccount();
     $user->populate(decode($this->_getParam('id')));
     // verify that the activation key in the url matches the one in the database
     if ($user->getActivationKey() != $this->_getParam('actkey')) {
         // send a link to enable the user to recover their password
         $error = "Invalid reset link. <br />Please try to recover your password again";
         $session->setVar(ERROR_MESSAGE, $error);
         $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
     }
 }
Exemplo n.º 3
0
 function activateAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     if (!isArrayKeyAnEmptyString('id', $formvalues)) {
         // debugMessage($formvalues);
         $user = new UserAccount();
         $user->populate(decode($formvalues['id']));
         // debugMessage($user->toArray()); // exit;
         if ($user->isUserActive() && isEmptyString($user->getActivationKey())) {
             // account already activated
             $session->setVar(ERROR_MESSAGE, 'Account is already activated. Please login.');
             $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
         }
         $this->_setParam(URL_FAILURE, encode($this->view->baseUrl("signup/confirm/id/" . encode($user->getID()))));
         $key = $this->_getParam('actkey');
         $this->view->result = $user->activateAccount($key);
         // exit();
         if (!$this->view->result) {
             // activation failed
             $this->view->message = $user->getErrorStackAsString();
             $session->setVar(FORM_VALUES, $this->_getAllParams());
             $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
             // debugMessage('error '.$user->getErrorStackAsString());
         } else {
             # send activation confirmation
             $user->sendActivationConfirmationNotification();
             $session->setVar(SUCCESS_MESSAGE, "Account activated successfully. Please login to start.");
         }
     }
     $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
     // exit;
 }