isPending() public method

Test if user is pending
public isPending ( ) : boolean
return boolean
 public function preDispatch()
 {
     if (empty($this->user)) {
         $this->_helper->redirector('index', 'auth');
     }
     if ($this->user->isPending()) {
         $this->_helper->redirector('confirm', 'register');
     }
 }
Esempio n. 2
0
 public function testPending()
 {
     $user = new User('email');
     $this->assertTrue($user->isPending());
     $user->setActive();
     $this->assertTrue($user->isPending());
     $user->setUsername('uname');
     $this->assertFalse($user->isPending());
 }
 public function isPending()
 {
     $this->__load();
     return parent::isPending();
 }
Esempio n. 4
0
 /**
  * Save pending user
  *
  * @param array                $data
  * @param Newscoop\Entity\User $user
  *
  * @return void
  */
 public function savePending($data, User $user)
 {
     if (!$user->isPending()) {
         throw new \InvalidArgumentException("User '{$user->getUsername()}' is not pending user.");
     }
     $user->setActive();
     $user->setPublic(true);
     $this->save($data, $user);
     return $this;
 }
Esempio n. 5
0
 /**
  * Delete user
  *
  * @param  Newscoop\Entity\User $user
  * @return void
  */
 public function delete(User $user)
 {
     if ($user->isPending()) {
         $this->getEntityManager()->remove($user);
     } else {
         $user->setStatus(User::STATUS_DELETED);
         $user->setEmail(null);
         $user->setFirstName(null);
         $user->setLastName(null);
         $this->removeAttributes($user);
     }
     $this->getEntityManager()->flush();
 }