function activateAction() { $this->_helper->layout->disableLayout(); $activateCode = $this->_request->getParam('p'); $message = ''; $activeLink = $this->view->home . '/public/register/activate/p/' . $activateCode; $temporaryLink = new TemporaryLink(); $temporaryLinkData = $temporaryLink->fetchRow('link like "%' . $activeLink . '%"'); $conumserModel = new Consumer(); $consumerData = $conumserModel->fetchRow('email like "%' . $temporaryLinkData->email . '%"'); if ($consumerData->state == 'ACTIVE') { $message = $this->view->translate('Has_actived'); } elseif ($temporaryLinkData->expire_date < date("Y-m-d H:i:s")) { $message = $this->view->translate('OutOfDate_register'); } else { $consumerData->state = 'ACTIVE'; $consumerData->save(); } $this->view->message = $message; }
function resetpasswordAction() { $this->_helper->layout->disableLayout(); $p = $this->_request->getParam("p"); $this->view->p = $p; if ($this->_request->isPost()) { $newpassword = $this->_request->getParam("newpassword"); $confirm = $this->_request->getParam("confirm"); if ($newpassword != $confirm || strlen($newpassword) < 6 || strlen($confirm) < 6) { $this->view->errMessage = $this->view->translate('Fail_New_password_is_incorrect!'); $this->view->p = $p; } else { $temporaryLinkModel = new TemporaryLink(); $currentTime = date("Y-m-d H:i:s"); $temporaryLink = $temporaryLinkModel->fetchRow("link like '%" . $p . "%' and expire_date >= '" . $currentTime . "'"); $email = $temporaryLink->email; $login_phone = $temporaryLink->login_phone; //not delete $temporaryLink in DB if ($email != null) { $consumerModel = new Consumer(); $consumer = $consumerModel->fetchRow("email = '" . $email . "'"); $consumer->password = md5($newpassword); $consumer->save(); $this->view->showMessage = $this->view->translate('You_have_reset_the_password!'); } else { if ($login_phone != null) { $consumerModel = new Consumer(); $consumer = $consumerModel->fetchRow("login_phone = '" . $login_phone . "'"); $consumer->password = md5($newpassword); $consumer->save(); $this->view->showMessage = $this->view->translate('You_have_reset_the_password!'); } else { $this->view->errMessage = $this->view->translate('Your_reset_passwrod_link'); } } } } // Zend_Debug::dump($p); }