コード例 #1
0
ファイル: AccountChecker.php プロジェクト: notbrain/symfony
 /**
  * {@inheritdoc}
  */
 public function checkPostAuth(AccountInterface $account)
 {
     if (!$account instanceof AdvancedAccountInterface) {
         return;
     }
     if (!$account->isAccountNonLocked()) {
         throw new LockedException('User account is locked.', $account);
     }
     if (!$account->isEnabled()) {
         throw new DisabledException('User account is disabled.', $account);
     }
     if (!$account->isAccountNonExpired()) {
         throw new AccountExpiredException('User account has expired.', $account);
     }
 }
コード例 #2
0
ファイル: User.php プロジェクト: naderman/UserBundle
    /**
     * Implementation of AccountInterface.
     *
     * @param AccountInterface $account
     * @return boolean
     */
    public function equals(AccountInterface $account)
    {
        if (!$account instanceof User) {
            return false;
        }

        if ($this->password !== $account->getPassword()) {
            return false;
        }
        if ($this->getSalt() !== $account->getSalt()) {
            return false;
        }
        if ($this->usernameCanonical !== $account->getUsernameCanonical()) {
            return false;
        }
        if ($this->isAccountNonExpired() !== $account->isAccountNonExpired()) {
            return false;
        }
        if (!$this->locked !== $account->isAccountNonLocked()) {
            return false;
        }
        if ($this->isCredentialsNonExpired() !== $account->isCredentialsNonExpired()) {
            return false;
        }
        if ($this->enabled !== $account->isEnabled()) {
            return false;
        }

        return true;
    }