-
Notifications
You must be signed in to change notification settings - Fork 1.6k
More flexibility for registration #874
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
Comments
If you only want to overwrite the template, use the template overwriting feature by putting it in |
If you need to override the action, for example you got too much logic to change there go ahead.
|
I'm stumbled upon a similar problem: in my case, I need to change the behavior of the registration process, not just the looks of it. In my scenario, the user register and gets created as disabled, and an email need to be sent to some admin that will later on approve the account using SonataUserBundle's admin interface. To do so, it seems like I need to override the registration controller, the form handler, and the user manager (and lets see what else). It's really nice that we can override the controllers, but in this case it seems pretty useless since a relevant part of the logic is done in the form handler and the user manager, both of which are private services, which makes it even harder to override. Also, and I didn't research this thoroughly, so pardon me if I'm saying something awfully wrong, but the registration controller and registration form handler seem to be so specific that they can neither be used on their own nor reused for something else. I have two suggestions: first, don't use private services. anyway, just my 2 cents. |
Replacing the form handler is possible through the configuration. And the form handler is a public service. We create an alias of the actual implementation (the default one being private) And see #867 for the upcoming version of the logic. As you can see, the confirmation email logic is now handled by a dedicated listener. Your logic sending a mail to the admin would simply be a matter of writing your own listener hooking into the events. |
Well, I just finished taking a look at it, and it seems really easy to extend, specially when compared to the previous implementation. congratulations on the excelent job ;) |
@tiagojsag, @arodiss: So any thoughts on this ticket after hearing from Stof? Should any of this be adapted or continued at all? |
Also you might be interested in view events that i provided in pull request #913 but it looks like repository owners not really like contributions from outside or just have no time to review the changes... |
For my implementation it was enough to avoid rewriting a bunch of code that could be reused. I did miss some additional data being passed to some events, but in the end I was able to make it work anyway ;) for me, this can be closed |
@tiagojsag : what information would you like to see added to the events? |
Several events have been added. |
While securityController provides a possibility to override template used for login (via renderLogin() method overriding), registrationController does not offer such functionality. The used template is defined in action method itself, and so to override it I have to copy-paste whole method or inherit bundle.
From my POV it would be nice to separate template rendering as it is done in securityController
Thanks.
The text was updated successfully, but these errors were encountered: