當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Finder::findUserByUsernameOrEmail方法代碼示例

本文整理匯總了PHP中dektrium\user\Finder::findUserByUsernameOrEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Finder::findUserByUsernameOrEmail方法的具體用法?PHP Finder::findUserByUsernameOrEmail怎麽用?PHP Finder::findUserByUsernameOrEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dektrium\user\Finder的用法示例。


在下文中一共展示了Finder::findUserByUsernameOrEmail方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionIndex

 /**
  * Updates user's password to given.
  *
  * @param string $search   Email or username
  * @param string $password New password
  */
 public function actionIndex($search, $password)
 {
     $user = $this->finder->findUserByUsernameOrEmail($search);
     if ($user === null) {
         $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED);
     } else {
         if ($user->resetPassword($password)) {
             $this->stdout(Yii::t('user', 'Password has been changed') . "\n", Console::FG_GREEN);
         } else {
             $this->stdout(Yii::t('user', 'Error occurred while changing password') . "\n", Console::FG_RED);
         }
     }
 }
開發者ID:TheManagers,項目名稱:yii2-user,代碼行數:19,代碼來源:PasswordController.php

示例2: actionIndex

 /**
  * Confirms a user by setting confirmed_at field to current time.
  *
  * @param string $search Email or username
  */
 public function actionIndex($search)
 {
     $user = $this->finder->findUserByUsernameOrEmail($search);
     if ($user === null) {
         $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED);
     } else {
         if ($user->confirm()) {
             $this->stdout(Yii::t('user', 'User has been confirmed') . "\n", Console::FG_GREEN);
         } else {
             $this->stdout(Yii::t('user', 'Error occurred while confirming user') . "\n", Console::FG_RED);
         }
     }
 }
開發者ID:chabberwock,項目名稱:halo-dev,代碼行數:18,代碼來源:ConfirmController.php

示例3: actionIndex

 /**
  * Deletes a user.
  *
  * @param string $search Email or username
  */
 public function actionIndex($search)
 {
     if ($this->confirm(\Yii::t('user', 'Are you sure? Deleted user can not be restored'))) {
         $user = $this->finder->findUserByUsernameOrEmail($search);
         if ($user === null) {
             $this->stdout(\Yii::t('user', 'User is not found') . "\n", Console::FG_RED);
         } else {
             if ($user->delete()) {
                 $this->stdout(\Yii::t('user', 'User has been deleted') . "\n", Console::FG_GREEN);
             } else {
                 $this->stdout(\Yii::t('user', 'Error occurred while deleting user') . "\n", Console::FG_RED);
             }
         }
     }
 }
開發者ID:manyoubaby123,項目名稱:imshop,代碼行數:20,代碼來源:DeleteController.php

示例4: beforeValidate

 /** @inheritdoc */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         $this->user = $this->finder->findUserByUsernameOrEmail(trim($this->login));
         return true;
     } else {
         return false;
     }
 }
開發者ID:damasco,項目名稱:yii2-user,代碼行數:10,代碼來源:LoginForm.php


注:本文中的dektrium\user\Finder::findUserByUsernameOrEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。