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


PHP UsersPeer::getUserByEmail方法代码示例

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


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

示例1: executeForgotPassword

 /**
  * Forgot Password page.
  * 
  * Request the email address, because the form is less easily abused this way
  * (restting another person's password, or spamming another person's emails)
  * 
  * Still too simplistic, ideally should add another step so that the password
  * is not automatically reset.
  * 
  */
 public function executeForgotPassword($request)
 {
     if ($request->getMethod() != coreRequest::POST) {
         return coreView::SUCCESS;
     }
     // handle the form submission
     $validator = new coreValidator($this->getActionName());
     if ($validator->validate($request->getParameterHolder()->getAll())) {
         $email_address = trim($request->getParameter('email_address'));
         $user = UsersPeer::getUserByEmail($email_address);
         if ($user) {
             // set new random password
             $raw_password = strtoupper(substr(md5(rand(100000, 999999)), 0, 8));
             // update the password on main site and forum
             $this->getUser()->changePassword($user['username'], $raw_password);
             // send email with new password, user username from db here to email user with the
             // username in the exact CaSe they registered with
             $mailer = new rtkMail();
             $mailer->sendForgotPasswordConfirmation($user['email'], $user['username'], $raw_password);
             return 'MailSent';
         } else {
             $request->setError('email_invalid', 'Sorry, no user found with that email address.');
             return coreView::SUCCESS;
         }
     }
 }
开发者ID:nikitakit,项目名称:RevTK,代码行数:36,代码来源:actions.php


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