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


PHP UserInterface::isAccountNonLocked方法代码示例

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


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

示例1: checkPostAuth

 public function checkPostAuth(UserInterface $user)
 {
     if (!$user instanceof AdvancedUserInterface) {
         return;
     }
     if (!$user->isAccountNonLocked()) {
         $ex = new LockedException('User account is locked.');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isEnabled() and $user->getStatus() == User::STATUS_BAD_EMAIL) {
         $ex = new DisabledException('BAD_EMAIL');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isEnabled()) {
         $ex = new DisabledException('DISABLED');
         if ($user instanceof User && $user->getConfirmationToken()) {
             $ex = new DisabledException('DISABLED:' . Strings::base64EncodeUrl($user->getEmail()));
         }
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isAccountNonExpired()) {
         $ex = new AccountExpiredException('User account has expired.');
         $ex->setUser($user);
         throw $ex;
     }
 }
开发者ID:scottstuff,项目名称:GCProtractorJS,代码行数:29,代码来源:UserChecker.php

示例2: processRecord

 /**
  * @param array $record
  *
  * @return array
  */
 public function processRecord(array $record)
 {
     if (is_null($this->user)) {
         /* @var TokenStorageInterface $securityTokenStorage */
         $securityTokenStorage = $this->container->get('security.token_storage');
         if ($securityTokenStorage !== null && $securityTokenStorage->getToken() !== null && $securityTokenStorage->getToken()->getUser() instanceof \Symfony\Component\Security\Core\User\AdvancedUserInterface) {
             $this->user = $securityTokenStorage->getToken()->getUser();
             $this->record['extra']['user']['username'] = $this->user->getUsername();
             $this->record['extra']['user']['roles'] = $this->user->getRoles();
             $this->record['extra']['user']['is_account_non_expired'] = $this->user->isAccountNonExpired();
             $this->record['extra']['user']['is_account_non_locked'] = $this->user->isAccountNonLocked();
             $this->record['extra']['user']['is_credentials_non_expired'] = $this->user->isCredentialsNonExpired();
             $this->record['extra']['user']['is_enabled'] = $this->user->isEnabled();
         }
     }
     return array_merge($record, $this->record);
 }
开发者ID:BranchBit,项目名称:KunstmaanBundlesCMS,代码行数:22,代码来源:UserProcessor.php

示例3: processRecord

 /**
  * @param array $record
  *
  * @return array
  */
 public function processRecord(array $record)
 {
     if (is_null($this->user)) {
         /* @var SecurityContextInterface $securityContext */
         $securityContext = null;
         try {
             $this->container->get("security.context");
         } catch (ServiceCircularReferenceException $e) {
             //since the securitycontext is deprecated getting the context from the container results in a log line which tries to use this method again....
         }
         if ($securityContext !== null && $securityContext->getToken() !== null && $securityContext->getToken()->getUser() instanceof \Symfony\Component\Security\Core\User\AdvancedUserInterface) {
             $this->user = $securityContext->getToken()->getUser();
             $this->record['extra']['user']['username'] = $this->user->getUsername();
             $this->record['extra']['user']['roles'] = $this->user->getRoles();
             $this->record['extra']['user']['is_account_non_expired'] = $this->user->isAccountNonExpired();
             $this->record['extra']['user']['is_account_non_locked'] = $this->user->isAccountNonLocked();
             $this->record['extra']['user']['is_credentials_non_expired'] = $this->user->isCredentialsNonExpired();
             $this->record['extra']['user']['is_enabled'] = $this->user->isEnabled();
         }
     }
     return array_merge($record, $this->record);
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:27,代码来源:UserProcessor.php

示例4: checkPostAuth

 /**
  * {@inheritdoc}
  */
 public function checkPostAuth(UserInterface $user)
 {
     if (!$user instanceof AdvancedUserInterface) {
         return;
     }
     if (!$user->isAccountNonLocked()) {
         throw new LockedException('User account is locked.', $user);
     }
     if (!$user->isEnabled()) {
         throw new DisabledException('User account is disabled.', $user);
     }
     if (!$user->isAccountNonExpired()) {
         throw new AccountExpiredException('User account has expired.', $user);
     }
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:18,代码来源:UserChecker.php

示例5: checkPreAuth

 /**
  * {@inheritdoc}
  */
 public function checkPreAuth(UserInterface $user)
 {
     if (!$user instanceof AdvancedUserInterface) {
         return;
     }
     if (!$user->isAccountNonLocked()) {
         $ex = new LockedException('Le compte est actuellement bloqué. Veuillez patienter qu\'un administrateur le déverrouille.');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isEnabled()) {
         $ex = new DisabledException('User account is disabled.');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isAccountNonExpired()) {
         $ex = new AccountExpiredException('User account has expired.');
         $ex->setUser($user);
         throw $ex;
     }
 }
开发者ID:StanFrag,项目名称:CCM-Stage,代码行数:24,代码来源:UserChecker.php

示例6: checkPreAuth

 /**
  * {@inheritdoc}
  */
 public function checkPreAuth(UserInterface $user)
 {
     if (!$user instanceof AdvancedUserInterface) {
         return;
     }
     if (!$user->isAccountNonLocked()) {
         $ex = new LockedException('User account is locked.');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isEnabled()) {
         $ex = new DisabledException('User account is disabled.');
         $ex->setUser($user);
         throw $ex;
     }
     if (!$user->isAccountNonExpired()) {
         $ex = new AccountExpiredException('User account has expired.');
         $ex->setUser($user);
         throw $ex;
     }
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:24,代码来源:UserChecker.php

示例7: equals

 /**
  * Implementation of SecurityUserInterface.
  *
  * @param \Symfony\Component\Security\Core\User\UserInterface $user
  * @return Boolean
  */
 public function equals(SecurityUserInterface $user)
 {
     if (!$user instanceof User) {
         return false;
     }
     if ($this->getPassword() !== $user->getPassword()) {
         return false;
     }
     if ($this->getSalt() !== $user->getSalt()) {
         return false;
     }
     if ($this->getUsernameCanonical() !== $user->getUsernameCanonical()) {
         return false;
     }
     if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) {
         return false;
     }
     if ($this->isAccountNonLocked() !== $user->isAccountNonLocked()) {
         return false;
     }
     if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) {
         return false;
     }
     if ($this->isEnabled() !== $user->isEnabled()) {
         return false;
     }
     return true;
 }
开发者ID:Anmoldev,项目名称:FOSUserBundle,代码行数:34,代码来源:User.php

示例8: isAccountNonLocked

 public function isAccountNonLocked()
 {
     return $this->wrappedUser instanceof AdvancedUserInterface ? $this->wrappedUser->isAccountNonLocked() : true;
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:4,代码来源:UserWrapped.php

示例9: equals

 public function equals(UserInterface $user)
 {
     if (!$user instanceof User) {
         return false;
     }
     if ($this->password !== $user->getPassword()) {
         return false;
     }
     if ($this->getSalt() !== $user->getSalt()) {
         return false;
     }
     if ($this->isAccountNonExpired() !== $user->isAccountNonExpired()) {
         return false;
     }
     if (!$this->locked !== $user->isAccountNonLocked()) {
         return false;
     }
     if ($this->isCredentialsNonExpired() !== $user->isCredentialsNonExpired()) {
         return false;
     }
     if ($this->enabled !== $user->isEnabled()) {
         return false;
     }
     return true;
 }
开发者ID:hollodk,项目名称:clubmaster,代码行数:25,代码来源:User.php


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