當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。