Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Reset Password Optional #1576

Open
wants to merge 10 commits into
base: 5.x
Choose a base branch
from

Conversation

Hanmac
Copy link
Contributor

@Hanmac Hanmac commented Oct 13, 2022

Subject

I am targeting this branch, because its BC break (most likely).

Closes #1491.

Changelog

### Changed
- Make Reset Password Optional

To do

  • Update the tests, i probably need new App Configs without Mailer
  • Update the documentation;
  • Add an upgrade note.

@SonataCI
Copy link
Collaborator

Could you please rebase your PR and fix merge conflicts?

@Hanmac Hanmac marked this pull request as ready for review February 15, 2023 08:46
@Hanmac Hanmac closed this Feb 20, 2023
@Hanmac Hanmac reopened this Feb 20, 2023
@Hanmac
Copy link
Contributor Author

Hanmac commented Feb 20, 2023

@VincentLanglet should i try to fix this errors even if i didn't touched this code?

@Hanmac
Copy link
Contributor Author

Hanmac commented Feb 20, 2023

getFlashBag needs symfony/symfony#46491 symfony/symfony@026c748
which only exists in Symfony 6.2+
so just do a $session instance of Session around it?

@VincentLanglet
Copy link
Member

I made #1595 ; you just need to rebase once 5.x will be in 6.x.

Btw, the 6.x release won't be soon. Can't you do the PR on the 5.x ? I don't see a real BC-break

@Hanmac Hanmac changed the base branch from 6.x to 5.x February 20, 2023 13:06
src/Action/LoginAction.php Outdated Show resolved Hide resolved
src/DependencyInjection/SonataUserExtension.php Outdated Show resolved Hide resolved
Copy link
Member

@VincentLanglet VincentLanglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok ; but didn't you plan to write doc and update note ?

@Hanmac
Copy link
Contributor Author

Hanmac commented Feb 27, 2023

Seems ok ; but didn't you plan to write doc and update note ?

I'm not very good at documentation and update note stuff

i probably need to write something like this:

When updating, please require "symfony/mailer" and "symfony/mime" manually
Or to disable the function, remove the configuration

IMO isn't this still a BC break? and shouldn't that be marked for remove next-major?

composer.json Outdated
Comment on lines 38 to 39
"symfony/mailer": "^4.4 || ^5.4 || ^6.0",
"symfony/mime": "^4.4.10 || ^5.4 || ^6.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VincentLanglet i'm unsure, is this a BC Break?

updating with composer would remove the dependency and composer would remove the packages?
which then causes a problem that the current default config (and what the user might have configured)
are still looking for the mailer packages? (i mean it probably would cause problems with cache:clear after composer update, so the user should see the problem directly?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly ping @jordisala1991.
I don't remember where but I think we already did such change (which an upgrade note).

The other option would be to keep those dependencies and only remove them in 6.x branch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you have to configure mailer, it should be a dep you have when installing this bundle. IMO we can try moving it to require-dev

composer.json Outdated Show resolved Hide resolved
$this->configureDefaultAvatar($config['profile'], $container);
if (isset($bundles['SonataAdminBundle'])) {
$this->configureAdmin($config['admin'], $container);
$this->configureResetting($config['resetting'], $container);
// check for reset configuration
if (isset($config['resetting']['email']['address'], $config['resetting']['email']['sender_name'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is missing a check to really validate the user has required deps (since they will be optional on require-dev) wdyt ?

@jordisala1991
Copy link
Member

WDYT about adding an option to disable reset mail (default to enabled) and deprecate not defining a value for it (like symfony did for the enable_authenticator_manager). Not sure how they did it or how hard is to implement. But would make the feature easier to discover.

Also, some docs about how to disable/enable the feature, would be nice.

@VincentLanglet
Copy link
Member

WDYT about adding an option to disable reset mail (default to enabled) and deprecate not defining a value for it (like symfony did for the enable_authenticator_manager). Not sure how they did it or how hard is to implement. But would make the feature easier to discover.

There is already

$config['resetting']['email']['address']
$config['resetting']['email']['sender_name']

which are two values required for reset mail

If you don't want reset mail, you remove those value ; and if you want reset mail, you set those values.
Isn't it enough ? It avoid handling case when you enable the reset mail but doesn't set those values...

@Hanmac Hanmac closed this Mar 7, 2023
@Hanmac Hanmac reopened this Mar 7, 2023
@SonataCI
Copy link
Collaborator

SonataCI commented Mar 8, 2023

Could you please rebase your PR and fix merge conflicts?

@VincentLanglet
Copy link
Member

Except the need of a rebase, this PR need to update the doc in order to explain how to enable/disable this feature @Hanmac

@Hanmac
Copy link
Contributor Author

Hanmac commented Mar 8, 2023

For the Documentation i need to think about what the best way to write it

@VincentLanglet
Copy link
Member

This part need to be updated https://github.com/sonata-project/SonataUserBundle/blob/5.x/docs/reference/installation.rst#configuration
since

resetting:
        email:
            address: sonata@localhost
            sender_name: Sonata Admin

is not mandatory.

I would say the routing too https://github.com/sonata-project/SonataUserBundle/blob/5.x/docs/reference/installation.rst#integrating-the-bundle-into-the-sonata-admin-bundle

Maybe this section too https://github.com/sonata-project/SonataUserBundle/blob/5.x/docs/reference/installation.rst#mailer-configuration

Basically we need for every reset-specific code to give an exemple with and without the feature.

@VincentLanglet
Copy link
Member

For the Documentation i need to think about what the best way to write it

Hi @Hanmac, how are you doing with the doc update ?
This PR would be a nice improvement to add to this bundle :)

@SonataCI
Copy link
Collaborator

Could you please rebase your PR and fix merge conflicts?

@VincentLanglet
Copy link
Member

Friendly ping @Hanmac ; any time for the doc update ? :)

Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 18, 2024
@Hanmac
Copy link
Contributor Author

Hanmac commented Jan 18, 2024

I still need to do this an some Doc Update

Maybe next Weekend

@github-actions github-actions bot removed the stale label Jan 18, 2024
@VincentLanglet
Copy link
Member

I still need to do this an some Doc Update

Maybe next Weekend

Thanks.

You'll also need a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make reset password optional
4 participants