Inheritance: extends Symfony\Component\Security\Core\User\AdvancedAccountInterface
コード例 #1
0
 public function sendEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['template']['new'];
     $url = $this->router->generate('fos_user_registration_confirm_email', ['token' => $user->getConfirmationToken(), 'email' => $user->getEmail()], true);
     $context = ['user' => $user, 'confirmationUrl' => $url];
     $this->sendMessage($template, $context, $this->parameters['from_email']['confirmation'], $user->getEmail());
 }
コード例 #2
0
 protected function onSuccess(UserInterface $user)
 {
     $user->setPlainPassword($this->getNewPassword());
     $user->setConfirmationToken(null);
     $user->setEnabled(true);
     $this->userManager->updateUser($user);
 }
コード例 #3
0
ファイル: Mailer.php プロジェクト: jjspider277/weddings
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['resetting.template'];
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #4
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     $user->setPasskey(md5(uniqid()));
     $user->setDateAdded(new \DateTime('now'));
     $user->setLastActivity(new \DateTime('now'));
     parent::onSuccess($user, $confirmation);
 }
コード例 #5
0
ファイル: Mailer.php プロジェクト: dasklney/kreta
 /**
  * {@inheritdoc}
  */
 public function sendInvitationEmail(UserInterface $user)
 {
     $template = $this->parameters['invitation.template'];
     $url = $this->router->generate('kreta_user_registration', ['token' => $user->getConfirmationToken()], true);
     $rendered = $this->templating->render($template, ['user' => $user, 'registerUrl' => $url]);
     $this->sendEmailMessage($rendered, self::KRETA_INVITATION_EMAIL, $user->getEmail());
 }
コード例 #6
0
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->getTemplate('resetting');
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $context = array('user' => $user, 'confirmationUrl' => $url);
     return $this->sendMessage($template, $context, $this->getFromEmail('resetting'), $user->getEmail());
 }
コード例 #7
0
ファイル: UserManager.php プロジェクト: Dren-x/mobitnew
 /**
  * {@inheritDoc}
  */
 public function reloadUser(UserInterface $user)
 {
     if (!$user instanceof \Persistent) {
         throw new \InvalidArgumentException('This user instance is not supported by the Propel UserManager implementation');
     }
     $user->reload();
 }
コード例 #8
0
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['template']['resetting'];
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
     $context = array('user' => $user, 'confirmationUrl' => $url);
     $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #9
0
ファイル: AbstractJournalItemMailer.php プロジェクト: ojs/ojs
 protected function sendMail(JournalItemEvent $itemEvent, $item, $action)
 {
     $journalItem = $itemEvent->getItem();
     foreach ($this->ojsMailer->getJournalRelatedUsers() as $user) {
         $this->ojsMailer->sendToUser($user, 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle(), 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle() . ' -> by ' . $this->user->getUsername());
     }
 }
コード例 #10
0
 /**
  * @param UserInterface $user
  */
 protected function onSuccess(UserInterface $user)
 {
     if ($this->getNewPassword() != "") {
         $user->setPlainPassword($this->getNewPassword());
     }
     $this->userManager->updateUser($user);
 }
コード例 #11
0
ファイル: UserEventListener.php プロジェクト: ulakjira/ojs
 /**
  * @param UserInterface $user
  * @param string $subject
  * @param string $body
  */
 private function sendMail(UserInterface $user, $subject, $body)
 {
     $message = $this->mailer->createMessage();
     $to = array($user->getEmail() => $user->getUsername());
     $message = $message->setSubject($subject)->addFrom($this->mailSender, $this->mailSenderName)->setTo($to)->setBody($body, 'text/html');
     $this->mailer->send($message);
 }
コード例 #12
0
ファイル: Mailer.php プロジェクト: tkuska/user
 /**
  * {@inheritdoc}
  */
 public function sendCreationEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['creation.template'];
     $url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), UrlGeneratorInterface::ABSOLUTE_URL);
     $rendered = $this->templating->render($template, array('user' => $user, 'password' => $user->getPlainPassword(), 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['creation'], $user->getEmail());
 }
コード例 #13
0
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['template']['resetting'];
     $url = $this->router->generate('get_reset_resetting', array('token' => $user->getConfirmationToken()), true);
     $context = array('user' => $user, 'confirmationUrl' => str_replace('api', '#', $url));
     $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #14
0
ファイル: Mailer.php プロジェクト: KnpLabs/KnpUserBundle
 public function sendResettingEmailMessage(UserInterface $user, $engine)
 {
     $template = $this->parameters['resetting_password.template'];
     $url = $this->router->generate('fos_user_user_reset_password', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template . '.txt.' . $engine, array('user' => $user, 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->getSenderEmail('resetting_password'), $user->getEmail());
 }
コード例 #15
0
 /**
  * Make user date and time settings sticky
  *
  * @param UserInterface $user
  * @param SessionInterface $session
  */
 protected function storeDateTimeSettingsInSession(UserInterface $user, SessionInterface $session)
 {
     $session->set('campaignchain.locale', $user->getLocale());
     $session->set('campaignchain.timezone', $user->getTimezone());
     $session->set('campaignchain.dateFormat', $user->getDateFormat());
     $session->set('campaignchain.timeFormat', $user->getTimeFormat());
 }
コード例 #16
0
 /**
  * get Array with Principal-Data from User-Object.
  *
  * @param UserInterface|GroupInterface $principalObject
  * @param bool                         $show_id
  *
  * @return array
  *
  * @throws Exception
  */
 private function getPrincipalArray($principalObject, $show_id = false)
 {
     if (!$principalObject instanceof UserInterface && !$principalObject instanceof GroupInterface) {
         throw new Exception('$principalObject must be of type UserInterface of GroupInterface');
     }
     $principal = array();
     if ($show_id) {
         $principal['id'] = $principalObject->getId();
     }
     if ($principalObject instanceof UserInterface) {
         $principal['uri'] = 'principals/' . $principalObject->getUsername();
     } else {
         $principal['uri'] = 'principals/' . $principalObject->getName();
     }
     // get all fields from $this->fieldMap, additional to 'uri' and 'id'
     foreach ($this->fieldMap as $key => $value) {
         if (!method_exists($principalObject, $value['getter'])) {
             continue;
         }
         $valueGetter = call_user_func(array($principalObject, $value['getter']));
         if ($valueGetter) {
             $principal[$key] = $valueGetter;
         }
     }
     return $principal;
 }
コード例 #17
0
ファイル: Mailer.php プロジェクト: rommsen/plesynd
 public function sendConfirmationEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['confirmation.template'];
     $url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), true);
     $rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => str_replace('%23', '#', $url)));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['confirmation'], $user->getEmail());
 }
コード例 #18
0
 /**
  * @param UserInterface $user
  * @return UserDTO
  */
 public static function withEntity(UserInterface $user)
 {
     $dto = new UserDTO();
     $dto->setId($user->getId());
     $dto->setEmail($user->getEmail());
     $dto->setApiKey($user->getApiKey());
     return $dto;
 }
コード例 #19
0
 /**
  * {@inheritDoc}
  */
 public function updatePassword(UserInterface $user)
 {
     if ($user instanceof UserWrapped) {
         parent::updatePassword($user->getInterfacedUser());
         return;
     }
     parent::updatePassword($user);
 }
コード例 #20
0
ファイル: Mailer.php プロジェクト: bruery/platform
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['template']['resetting'];
     $url = $this->router->generate('sonata_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $email = key($this->parameters['from_email']['resetting']);
     $context = array('user' => $user, 'confirmationUrl' => $url, 'ttl' => $this->parameters['ttl'], 'email' => $email, 'administrator' => $this->parameters['from_email']['resetting'][$email], 'request' => $this->requestStack->getCurrentRequest());
     $this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #21
0
 /**
  * Get the truncated email displayed when requesting the resetting.
  *
  * The default implementation only keeps the part following @ in the address.
  *
  * @param \FOS\UserBundle\Model\UserInterface $user
  *
  * @return string
  */
 protected function getObfuscatedEmail(UserInterface $user)
 {
     $email = $user->getEmail();
     if (false !== ($pos = strpos($email, '@'))) {
         $email = '...' . substr($email, $pos);
     }
     return $email;
 }
コード例 #22
0
 /**
  * {@inheritdoc}
  */
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $url = $this->router->generate('fos_user_resetting_reset', array('token' => $user->getConfirmationToken()), true);
     $subject = $this->translate('resetting.email.subject', $user->getUsername(), $url);
     $body = $this->translate('resetting.email.message', $user->getUsername(), $url);
     $rendered = $this->templating->render('@App/Utils/email_structure.html.twig', array('body' => $body));
     $this->sendEmailMessage($rendered, $subject, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #23
0
 protected function sendMail(JournalItemEvent $itemEvent, $item, $action)
 {
     $mailUsers = $this->em->getRepository('OjsUserBundle:User')->findUsersByJournalRole(['ROLE_JOURNAL_MANAGER', 'ROLE_EDITOR']);
     $journalItem = $itemEvent->getItem();
     foreach ($mailUsers as $user) {
         $this->ojsMailer->sendToUser($user, 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle(), 'A ' . $item . ' ' . $action . ' -> ' . $journalItem->getJournal()->getTitle() . ' -> by ' . $this->user->getUsername());
     }
 }
コード例 #24
0
ファイル: Mailer.php プロジェクト: viettut/todo
 /**
  * Override for change resetting url
  * {@inheritdoc}
  */
 public function sendResettingEmailMessage(UserInterface $user)
 {
     $template = $this->parameters['resetting.template'];
     $resetLink = $this->parameters['password_resetting_link'];
     $url = $resetLink . '/' . $user->getConfirmationToken();
     $rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $user->getEmail());
 }
コード例 #25
0
 public function subscribe(UserInterface $user, PlanInterface $plan)
 {
     $subscription = new $this->class();
     $subscription->setName($plan->getName())->setCurrency($plan->getCurrency())->setPrice($plan->getPrice())->setDiscount($plan->getDiscount())->setPlan($plan);
     $user->addSubscription($subscription);
     $this->event_dispatcher->dispatch(SaaSEvents::SUBSCRIBED, new SubscriptionEvent($subscription));
     return $subscription;
 }
 /**
  * {@inheritdoc}
  */
 protected function getRedirectionUrl(UserInterface $user)
 {
     $rolesTab = $user->getRoles();
     if (in_array('ROLE_ADMIN', $rolesTab, true) || in_array('ROLE_SUPER_ADMIN', $rolesTab, true)) {
         return $this->container->get('router')->generate('sonata_admin_dashboard');
     } else {
         return $this->container->get('router')->generate('sonata_user_profile_show');
     }
 }
コード例 #27
0
 private function updateMentorRelationships(UserInterface $user)
 {
     $user->setFirstName("WORKING");
     foreach ($user->getCourses() as $course) {
         $user->removeCourse($course);
         $course->setMentor($user);
         $user->addCourse($course);
     }
 }
コード例 #28
0
 protected function onSuccess(UserInterface $user, $confirmation)
 {
     // Note: if you plan on modifying the user then do it before calling the
     // parent method as the parent method will flush the changes
     $user->addRole('ROLE_NORMAL_USER');
     $user->setRegistrationStatus('complete');
     $user->setSalt($this->random_key_generator(20));
     parent::onSuccess($user, $confirmation);
     // otherwise add your functionality here
 }
コード例 #29
0
 /**
  * Transforms a UserInterface instance into a username string.
  *
  * @param UserInterface|null $value UserInterface instance
  *
  * @return string|null Username
  *
  * @throws UnexpectedTypeException if the given value is not a UserInterface instance
  */
 public function transform($value)
 {
     if (null === $value) {
         return null;
     }
     if (!$value instanceof UserInterface) {
         throw new UnexpectedTypeException($value, 'FOS\\UserBundle\\Model\\UserInterface');
     }
     return $value->getUsername();
 }
コード例 #30
0
ファイル: Mailer.php プロジェクト: sujit13666/SymfonyReal2
 public function sendConfirmationEmailMessage(UserInterface $user)
 {
     //        var_dump($user->getConfirmationToken());
     //        die();
     $template = $this->parameters['confirmation.template'];
     //        $url = $this->router->generate('fos_user_registration_confirm', array('token' => $user->getConfirmationToken()), true);
     $url = "http://localhost:8080/SymfonyClient/app/#/core/signup/confirm/?code=" . $user->getConfirmationToken();
     $rendered = $this->templating->render($template, array('user' => $user, 'confirmationUrl' => $url));
     $this->sendEmailMessage($rendered, $this->parameters['from_email']['confirmation'], $user->getEmail());
 }