Esempio n. 1
0
 public function getIdentity()
 {
     $identity = parent::getIdentity();
     if (!$identity instanceof Identity) {
         return $identity;
     }
     if (!$this->checkConnection->invoke()) {
         return NULL;
     }
     if (!isset($this->identities[$identity->id])) {
         $this->identities[$identity->id] = $this->userRepository->findOneBy(array('id' => $identity->id, 'published' => 1));
     }
     return $this->identities[$identity->id];
 }
Esempio n. 2
0
 public function handleDisconnect($service)
 {
     $user = $this->extendedUser->getUser();
     foreach ($user->getLoginProviders() as $key => $item) {
         if ($item->getType() === $service) {
             $user->getLoginProviders()->remove($key);
             break;
         }
     }
     $this->userRepository->save($user);
     $this->redirect('this', array('provider' => NULL));
 }
Esempio n. 3
0
 public function resetFormSuccess(Form $form)
 {
     /** @var UserEntity $user */
     $user = $this->userRepository->findOneBy(array('email' => $form['email']->value));
     if (!$user) {
         $this->flashMessage($this->translator->translate('User with email %email% does not exist.', NULL, array('email' => $form['email']->value)), 'warning');
         return;
     }
     $this->sendEmail($user, $user->resetPassword());
     $this->userRepository->save($user);
     $this->flashMessage($this->translator->translate('New password has been sended'), 'success');
     $this->redirect('this', array('reset' => NULL));
 }