public function preDispatch() { if (empty($this->user)) { $this->_helper->redirector('index', 'auth'); } if ($this->user->isPending()) { $this->_helper->redirector('confirm', 'register'); } }
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(); }
/** * 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; }
/** * 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(); }