Skip to content

Commit

Permalink
Merge pull request #2731 from stof/revert_update_email_confirmation
Browse files Browse the repository at this point in the history
Revert the email update confirmation feature
  • Loading branch information
stof authored Feb 16, 2018
2 parents 93ef16d + 8bb8789 commit cb27a67
Show file tree
Hide file tree
Showing 33 changed files with 5 additions and 1,177 deletions.
1 change: 0 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Changelog
* Add Symfony 4 compatibility.
* Redirect to login when requesting resetting password with invalid token.
* Added autocomplete hints for password inputs.
* Added email update confirmation option.
* Fixed several incorrect Turkish translations.

### 2.0.2 (2017-11-29)
Expand Down
90 changes: 0 additions & 90 deletions Controller/ConfirmEmailUpdateController.php

This file was deleted.

8 changes: 0 additions & 8 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ private function addProfileSection(ArrayNodeDefinition $node)
->end()
->end()
->end()
->arrayNode('email_update_confirmation')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')->defaultFalse()->end()
->scalarNode('cypher_method')->defaultNull()->end()
->scalarNode('email_template')->defaultValue('@FOSUser/Profile/email_update_confirmation.txt.twig')->end()
->end()
->end()
->end()
->end()
->end();
Expand Down
13 changes: 2 additions & 11 deletions DependencyInjection/FOSUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function load(array $configs, ContainerBuilder $container)
));

if (!empty($config['profile'])) {
$this->loadProfile($config['profile'], $container, $loader, $config['db_driver']);
$this->loadProfile($config['profile'], $container, $loader);
}

if (!empty($config['registration'])) {
Expand Down Expand Up @@ -189,20 +189,11 @@ protected function remapParametersNamespaces(array $config, ContainerBuilder $co
* @param array $config
* @param ContainerBuilder $container
* @param XmlFileLoader $loader
* @param string $dbDriver
*/
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader, $dbDriver)
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
$loader->load('profile.xml');

if ($config['email_update_confirmation']['enabled']) {
if ('custom' !== $dbDriver && isset(self::$doctrineDrivers[$dbDriver])) {
$loader->load('profile_email_update.xml');
}
$container->setParameter('fos_user.email_update_confirmation.template', $config['email_update_confirmation']['email_template']);
$container->setParameter('fos_user.email_update_confirmation.cypher_method', $config['email_update_confirmation']['cypher_method']);
}

$this->remapParametersNamespaces($config, $container, array(
'form' => 'fos_user.profile.form.%s',
));
Expand Down
87 changes: 0 additions & 87 deletions Doctrine/EmailUpdateListener.php

This file was deleted.

17 changes: 0 additions & 17 deletions EventListener/FlashListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class FlashListener implements EventSubscriberInterface
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'profile.flash.updated',
FOSUserEvents::REGISTRATION_COMPLETED => 'registration.flash.user_created',
FOSUserEvents::RESETTING_RESET_COMPLETED => 'resetting.flash.success',
FOSUserEvents::EMAIL_UPDATE_SUCCESS => 'email_update.flash.success',
FOSUserEvents::EMAIL_UPDATE_INITIALIZE => 'email_update.flash.info',
);

/**
Expand Down Expand Up @@ -69,8 +67,6 @@ public static function getSubscribedEvents()
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'addSuccessFlash',
FOSUserEvents::REGISTRATION_COMPLETED => 'addSuccessFlash',
FOSUserEvents::RESETTING_RESET_COMPLETED => 'addSuccessFlash',
FOSUserEvents::EMAIL_UPDATE_SUCCESS => 'addSuccessFlash',
FOSUserEvents::EMAIL_UPDATE_INITIALIZE => 'addInfoFlash',
);
}

Expand All @@ -87,19 +83,6 @@ public function addSuccessFlash(Event $event, $eventName)
$this->session->getFlashBag()->add('success', $this->trans(self::$successMessages[$eventName]));
}

/**
* @param Event $event
* @param string $eventName
*/
public function addInfoFlash(Event $event, $eventName)
{
if (!isset(self::$successMessages[$eventName])) {
throw new \InvalidArgumentException('This event does not correspond to a known flash message');
}

$this->session->getFlashBag()->add('info', $this->trans(self::$successMessages[$eventName]));
}

/**
* @param string$message
* @param array $params
Expand Down
18 changes: 0 additions & 18 deletions FOSUserEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,4 @@ final class FOSUserEvents
* @Event("FOS\UserBundle\Event\UserEvent")
*/
const USER_DEMOTED = 'fos_user.user.demoted';

/**
* The EMAIL_UPDATE_INITIALIZE event occurs when the email update process is initialized.
*
* This event allows you to access the user and to add some behaviour after email update is initialized..
*
* @Event("FOS\UserBundle\Event\UserEvent")
*/
const EMAIL_UPDATE_INITIALIZE = 'fos_user.update_email.initialize';

/**
* The EMAIL_UPDATE_SUCCESS event occurs when the email was successfully updated through confirmation link.
*
* This event allows you to access the user and to add some behaviour after email was confirmed and updated..
*
* @Event("FOS\UserBundle\Event\UserEvent")
*/
const EMAIL_UPDATE_SUCCESS = 'fos_user.update_email.success';
}
18 changes: 0 additions & 18 deletions Mailer/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,6 @@ public function sendResettingEmailMessage(UserInterface $user)
$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], (string) $user->getEmail());
}

/**
* Send confirmation link to specified new user email.
*
* @param UserInterface $user
* @param string $confirmationUrl
* @param string $toEmail
*/
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
{
$template = $this->parameters['email_updating.template'];
$rendered = $this->templating->render($template, array(
'user' => $user,
'confirmationUrl' => $confirmationUrl,
));

$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $toEmail);
}

/**
* @param string $renderedTemplate
* @param array|string $fromEmail
Expand Down
9 changes: 0 additions & 9 deletions Mailer/MailerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,4 @@ public function sendConfirmationEmailMessage(UserInterface $user);
* @param UserInterface $user
*/
public function sendResettingEmailMessage(UserInterface $user);

/**
* Send an email to a user to confirm the changed email address.
*
* @param UserInterface $user
* @param string $confirmationUrl
* @param string $toEmail
*/
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail);
}
8 changes: 0 additions & 8 deletions Mailer/NoopMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,4 @@ public function sendResettingEmailMessage(UserInterface $user)
{
// nothing happens.
}

/**
* {@inheritdoc}
*/
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
{
// nothing happens.
}
}
20 changes: 0 additions & 20 deletions Mailer/TwigSwiftMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,6 @@ public function sendResettingEmailMessage(UserInterface $user)
$this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], (string) $user->getEmail());
}

/**
* Send confirmation link to specified new user email.
*
* @param UserInterface $user
* @param $confirmationUrl
* @param $toEmail
*
* @return bool
*/
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
{
$template = $this->parameters['template']['email_updating'];
$context = array(
'user' => $user,
'confirmationUrl' => $confirmationUrl,
);

$this->sendMessage($template, $context, $this->parameters['from_email']['confirmation'], $toEmail);
}

/**
* @param string $templateName
* @param array $context
Expand Down
1 change: 0 additions & 1 deletion Resources/config/email_confirmation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<argument type="service" id="router" />
<argument type="service" id="session" />
</service>

</services>

</container>
Loading

0 comments on commit cb27a67

Please sign in to comment.