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


PHP IUserManager::getByEmail方法代碼示例

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


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

示例1: findByUri

 /**
  * @param string $uri
  * @param string $principalPrefix
  * @return string
  */
 function findByUri($uri, $principalPrefix)
 {
     if (substr($uri, 0, 7) === 'mailto:') {
         $email = substr($uri, 7);
         $users = $this->userManager->getByEmail($email);
         if (count($users) === 1) {
             return $this->principalPrefix . '/' . $users[0]->getUID();
         }
     }
     return '';
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:16,代碼來源:principal.php

示例2: isTwoFactorEnforced

 protected function isTwoFactorEnforced($username)
 {
     Util::emitHook('\\OCA\\Files_Sharing\\API\\Server2Server', 'preLoginNameUsedAsUserName', array('uid' => &$username));
     $user = $this->manager->get($username);
     if (is_null($user)) {
         $users = $this->manager->getByEmail($username);
         if (count($users) !== 1) {
             return true;
         }
         $user = $users[0];
     }
     // DI not possible due to cyclic dependencies :'-/
     return OC::$server->getTwoFactorAuthManager()->isTwoFactorAuthenticated($user);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:14,代碼來源:Session.php

示例3: tryLogin

 /**
  * @PublicPage
  * @UseSession
  *
  * @param string $user
  * @param string $password
  * @param string $redirect_url
  * @return RedirectResponse
  */
 public function tryLogin($user, $password, $redirect_url)
 {
     $originalUser = $user;
     // TODO: Add all the insane error handling
     /* @var $loginResult IUser */
     $loginResult = $this->userManager->checkPassword($user, $password);
     if ($loginResult === false) {
         $users = $this->userManager->getByEmail($user);
         // we only allow login by email if unique
         if (count($users) === 1) {
             $user = $users[0]->getUID();
             $loginResult = $this->userManager->checkPassword($user, $password);
         }
     }
     if ($loginResult === false) {
         $this->session->set('loginMessages', [['invalidpassword']]);
         // Read current user and append if possible - we need to return the unmodified user otherwise we will leak the login name
         $args = !is_null($user) ? ['user' => $originalUser] : [];
         return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
     }
     // TODO: remove password checks from above and let the user session handle failures
     // requires https://github.com/owncloud/core/pull/24616
     $this->userSession->login($user, $password);
     $this->userSession->createSessionToken($this->request, $loginResult->getUID(), $user, $password);
     if ($this->twoFactorManager->isTwoFactorAuthenticated($loginResult)) {
         $this->twoFactorManager->prepareTwoFactorLogin($loginResult);
         if (!is_null($redirect_url)) {
             return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge', ['redirect_url' => $redirect_url]));
         }
         return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
     }
     if (!is_null($redirect_url) && $this->userSession->isLoggedIn()) {
         $location = $this->urlGenerator->getAbsoluteURL(urldecode($redirect_url));
         // Deny the redirect if the URL contains a @
         // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
         if (strpos($location, '@') === false) {
             return new RedirectResponse($location);
         }
     }
     return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index'));
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:50,代碼來源:LoginController.php


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