Skip to content

Commit 8bb8789

Browse files
committed
Revert the email update confirmation feature
The implementation is far from being in a state allowing to release it. The feature might be accepted again in the future with a different implementation, but the bundle should have releases without waiting for that.
1 parent bf92d79 commit 8bb8789

33 files changed

+5
-1177
lines changed

Changelog.md

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Changelog
66
* Add Symfony 4 compatibility.
77
* Redirect to login when requesting resetting password with invalid token.
88
* Added autocomplete hints for password inputs.
9-
* Added email update confirmation option.
109
* Fixed several incorrect Turkish translations.
1110

1211
### 2.0.2 (2017-11-29)

Controller/ConfirmEmailUpdateController.php

-90
This file was deleted.

DependencyInjection/Configuration.php

-8
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ private function addProfileSection(ArrayNodeDefinition $node)
109109
->end()
110110
->end()
111111
->end()
112-
->arrayNode('email_update_confirmation')
113-
->addDefaultsIfNotSet()
114-
->children()
115-
->booleanNode('enabled')->defaultFalse()->end()
116-
->scalarNode('cypher_method')->defaultNull()->end()
117-
->scalarNode('email_template')->defaultValue('@FOSUser/Profile/email_update_confirmation.txt.twig')->end()
118-
->end()
119-
->end()
120112
->end()
121113
->end()
122114
->end();

DependencyInjection/FOSUserExtension.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function load(array $configs, ContainerBuilder $container)
113113
));
114114

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

119119
if (!empty($config['registration'])) {
@@ -189,20 +189,11 @@ protected function remapParametersNamespaces(array $config, ContainerBuilder $co
189189
* @param array $config
190190
* @param ContainerBuilder $container
191191
* @param XmlFileLoader $loader
192-
* @param string $dbDriver
193192
*/
194-
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader, $dbDriver)
193+
private function loadProfile(array $config, ContainerBuilder $container, XmlFileLoader $loader)
195194
{
196195
$loader->load('profile.xml');
197196

198-
if ($config['email_update_confirmation']['enabled']) {
199-
if ('custom' !== $dbDriver && isset(self::$doctrineDrivers[$dbDriver])) {
200-
$loader->load('profile_email_update.xml');
201-
}
202-
$container->setParameter('fos_user.email_update_confirmation.template', $config['email_update_confirmation']['email_template']);
203-
$container->setParameter('fos_user.email_update_confirmation.cypher_method', $config['email_update_confirmation']['cypher_method']);
204-
}
205-
206197
$this->remapParametersNamespaces($config, $container, array(
207198
'form' => 'fos_user.profile.form.%s',
208199
));

Doctrine/EmailUpdateListener.php

-87
This file was deleted.

EventListener/FlashListener.php

-17
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class FlashListener implements EventSubscriberInterface
3030
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'profile.flash.updated',
3131
FOSUserEvents::REGISTRATION_COMPLETED => 'registration.flash.user_created',
3232
FOSUserEvents::RESETTING_RESET_COMPLETED => 'resetting.flash.success',
33-
FOSUserEvents::EMAIL_UPDATE_SUCCESS => 'email_update.flash.success',
34-
FOSUserEvents::EMAIL_UPDATE_INITIALIZE => 'email_update.flash.info',
3533
);
3634

3735
/**
@@ -69,8 +67,6 @@ public static function getSubscribedEvents()
6967
FOSUserEvents::PROFILE_EDIT_COMPLETED => 'addSuccessFlash',
7068
FOSUserEvents::REGISTRATION_COMPLETED => 'addSuccessFlash',
7169
FOSUserEvents::RESETTING_RESET_COMPLETED => 'addSuccessFlash',
72-
FOSUserEvents::EMAIL_UPDATE_SUCCESS => 'addSuccessFlash',
73-
FOSUserEvents::EMAIL_UPDATE_INITIALIZE => 'addInfoFlash',
7470
);
7571
}
7672

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

90-
/**
91-
* @param Event $event
92-
* @param string $eventName
93-
*/
94-
public function addInfoFlash(Event $event, $eventName)
95-
{
96-
if (!isset(self::$successMessages[$eventName])) {
97-
throw new \InvalidArgumentException('This event does not correspond to a known flash message');
98-
}
99-
100-
$this->session->getFlashBag()->add('info', $this->trans(self::$successMessages[$eventName]));
101-
}
102-
10386
/**
10487
* @param string$message
10588
* @param array $params

FOSUserEvents.php

-18
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,4 @@ final class FOSUserEvents
318318
* @Event("FOS\UserBundle\Event\UserEvent")
319319
*/
320320
const USER_DEMOTED = 'fos_user.user.demoted';
321-
322-
/**
323-
* The EMAIL_UPDATE_INITIALIZE event occurs when the email update process is initialized.
324-
*
325-
* This event allows you to access the user and to add some behaviour after email update is initialized..
326-
*
327-
* @Event("FOS\UserBundle\Event\UserEvent")
328-
*/
329-
const EMAIL_UPDATE_INITIALIZE = 'fos_user.update_email.initialize';
330-
331-
/**
332-
* The EMAIL_UPDATE_SUCCESS event occurs when the email was successfully updated through confirmation link.
333-
*
334-
* This event allows you to access the user and to add some behaviour after email was confirmed and updated..
335-
*
336-
* @Event("FOS\UserBundle\Event\UserEvent")
337-
*/
338-
const EMAIL_UPDATE_SUCCESS = 'fos_user.update_email.success';
339321
}

Mailer/Mailer.php

-18
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,6 @@ public function sendResettingEmailMessage(UserInterface $user)
8484
$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], (string) $user->getEmail());
8585
}
8686

87-
/**
88-
* Send confirmation link to specified new user email.
89-
*
90-
* @param UserInterface $user
91-
* @param string $confirmationUrl
92-
* @param string $toEmail
93-
*/
94-
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
95-
{
96-
$template = $this->parameters['email_updating.template'];
97-
$rendered = $this->templating->render($template, array(
98-
'user' => $user,
99-
'confirmationUrl' => $confirmationUrl,
100-
));
101-
102-
$this->sendEmailMessage($rendered, $this->parameters['from_email']['resetting'], $toEmail);
103-
}
104-
10587
/**
10688
* @param string $renderedTemplate
10789
* @param array|string $fromEmail

Mailer/MailerInterface.php

-9
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,4 @@ public function sendConfirmationEmailMessage(UserInterface $user);
3131
* @param UserInterface $user
3232
*/
3333
public function sendResettingEmailMessage(UserInterface $user);
34-
35-
/**
36-
* Send an email to a user to confirm the changed email address.
37-
*
38-
* @param UserInterface $user
39-
* @param string $confirmationUrl
40-
* @param string $toEmail
41-
*/
42-
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail);
4334
}

Mailer/NoopMailer.php

-8
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,4 @@ public function sendResettingEmailMessage(UserInterface $user)
3737
{
3838
// nothing happens.
3939
}
40-
41-
/**
42-
* {@inheritdoc}
43-
*/
44-
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
45-
{
46-
// nothing happens.
47-
}
4840
}

Mailer/TwigSwiftMailer.php

-20
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,6 @@ public function sendResettingEmailMessage(UserInterface $user)
8787
$this->sendMessage($template, $context, $this->parameters['from_email']['resetting'], (string) $user->getEmail());
8888
}
8989

90-
/**
91-
* Send confirmation link to specified new user email.
92-
*
93-
* @param UserInterface $user
94-
* @param $confirmationUrl
95-
* @param $toEmail
96-
*
97-
* @return bool
98-
*/
99-
public function sendUpdateEmailConfirmation(UserInterface $user, $confirmationUrl, $toEmail)
100-
{
101-
$template = $this->parameters['template']['email_updating'];
102-
$context = array(
103-
'user' => $user,
104-
'confirmationUrl' => $confirmationUrl,
105-
);
106-
107-
$this->sendMessage($template, $context, $this->parameters['from_email']['confirmation'], $toEmail);
108-
}
109-
11090
/**
11191
* @param string $templateName
11292
* @param array $context

Resources/config/email_confirmation.xml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<argument type="service" id="router" />
1313
<argument type="service" id="session" />
1414
</service>
15-
1615
</services>
1716

1817
</container>

0 commit comments

Comments
 (0)