protected function getRegisteredUser()
 {
     /* @var $auth \UthandoUser\Service\Authentication */
     $auth = $this->getApplicationServiceLocator()->get('Zend\\Authentication\\AuthenticationService');
     $user = new TestUserModel();
     $user->setFirstname('Joe')->setLastname('Bloggs')->setEmail('*****@*****.**')->setRole('registered')->setDateCreated(new \DateTime())->setDateModified(new \DateTime());
     $auth->getStorage()->write($user);
     return $user;
 }
 public function testRegisteredUserRedirectsToHome()
 {
     /* @var $auth \UthandoUser\Service\Authentication */
     $auth = $this->getApplicationServiceLocator()->get('Zend\\Authentication\\AuthenticationService');
     $user = new TestUserModel();
     $user->setFirstname('Joe')->setLastname('Bloggs')->setEmail('*****@*****.**')->setRole('registered');
     $auth->getStorage()->write($user);
     $this->dispatch('/admin');
     $this->assertResponseStatusCode(302);
     $this->assertRedirectTo('/');
 }
Exemple #3
0
 /**
  * Reset user password for admin and email user with new random password
  *
  * @param UserModel $user
  * @return int
  */
 public function resetPassword(UserModel $user)
 {
     $user->generatePassword();
     $result = $this->save($user);
     if ($result) {
         $emailView = new ViewModel(['user' => $user]);
         $emailView->setTemplate('uthando-user/email/reset-password');
         $this->getEventManager()->trigger('mail.send', $this, ['recipient' => ['name' => $user->getFullName(), 'address' => $user->getEmail()], 'layout' => 'uthando-user/email/layout', 'body' => $emailView, 'subject' => 'Reset Password', 'transport' => 'default']);
     }
     return $result;
 }
Exemple #4
0
 /**
  * @param \UthandoUser\Model\User $object
  * @return array
  */
 public function extract($object)
 {
     return ['userId' => $object->getUserId(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), 'email' => $object->getEmail(), 'passwd' => $this->extractValue('passwd', $object->getPasswd()), 'role' => $object->getRole(), 'dateCreated' => $this->extractValue('dateCreated', $object->getDateCreated()), 'dateModified' => $this->extractValue('dateModified', $object->getDateModified()), 'active' => $this->extractValue('active', $object->getActive())];
 }