当前位置: 首页>>代码示例>>PHP>>正文


PHP UserAccount::resetPassword方法代码示例

本文整理汇总了PHP中UserAccount::resetPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::resetPassword方法的具体用法?PHP UserAccount::resetPassword怎么用?PHP UserAccount::resetPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAccount的用法示例。


在下文中一共展示了UserAccount::resetPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processresetpasswordAction

 public function processresetpasswordAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $session = SessionWrapper::getInstance();
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues);
     $user = new UserAccount();
     $user->populate(decode($this->_getParam('id')));
     // debugMessage($user->toArray());
     $user->setUsername($formvalues['username']);
     $user->setStatus(1);
     $user->setAgreedToTerms(1);
     if (isEmptyString($user->getActivationDate())) {
         $startdate = date("Y-m-d H:i:s", time());
         $user->setActivationDate($startdate);
     }
     // exit();
     if ($user->resetPassword($this->_getParam('password'))) {
         // save to audit
         $url = $this->view->serverUrl($this->view->baseUrl('profile/view/id/' . encode($user->getID())));
         $usecase = '1.10';
         $module = '1';
         $type = USER_RESET_PASSWORD_CONFIRM;
         $details = "Reset password confirmed 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));
         // send a link to enable the user to recover their password
         $session->setVar(SUCCESS_MESSAGE, "Sucessfully saved. You can now log in using your new Password");
         $this->_helper->redirector->gotoUrl($this->view->baseUrl("user/login"));
     } else {
         // echo "cannot reset password";
         // send an error message that no user with that email was found
         $session = SessionWrapper::getInstance();
         $session->setVar(ERROR_MESSAGE, $user->getErrorStackAsString());
         $session->setVar(FORM_VALUES, $this->_getAllParams());
         $this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
     }
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:48,代码来源:UserController.php


注:本文中的UserAccount::resetPassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。