use FOSUSERBundle to change the password

Discuss Symfony 2 bundles here

Moderators: dcobalt, tiagojsag

use FOSUSERBundle to change the password

Postby dadaw36 » Thu May 31, 2012 11:47 am

hey ,

i want to use the fosUSerBundle to change the password of the logged person.
i'v already use the functionality, login , of FOS to log and it's works :)

But here, i want to have the form of changing password directly in my profilpage.html.twig .without been redirected to an other page .
and when i copy the code of the changepassword_content.html.twig in my profilpage.html.twig , i have an error the "form" is unknown {% form_theme form theme %}
which is right!! so can somebody explain me what i have to do ?! pleaseee
dadaw36
Junior Member
 
Posts: 3
Joined: Thu May 31, 2012 11:38 am

Re: use FOSUSERBundle to change the password

Postby dcobalt » Thu May 31, 2012 5:24 pm

It's not a matter of copy-pasting templates.

You have to somehow incorporate the function of ChangePasswordFormType into your (overridden) ProfileFormType. Maybe as a child form. Or, well, given that ProfileFormType already has CheckPassword, add an extra field.
Adding "plainPassword" as a formtype field -might- work, I'm not sure, I haven't tried that.
In any case, you'll need a bit of formtype wizardry - I would help you more if I could, but to be honest, I tried this exact same thing and just gave up halfway. I preferred having a separate change password form to be honest.
dcobalt
Faithful Member
 
Posts: 270
Joined: Thu Oct 20, 2011 6:06 pm

Re: use FOSUSERBundle to change the password

Postby dadaw36 » Thu May 31, 2012 8:15 pm

thank you "dcobalt" for answering! i'm really stock at this problem because i'm working on an existing php application, i'm taking it from Native PHP to Symphony2 architecture. And as you had the same problem i think we can fixe it :).

i tried to touch the FosUSerBundle files to make it work, what i did is to change the template that the bundle use ( it works!), in other hand, i create the function that gives me some session variables coming from the database .

the Magic trick now is to give the ChangePasswordController.php these session variables !!!
dadaw36
Junior Member
 
Posts: 3
Joined: Thu May 31, 2012 11:38 am

Re: use FOSUSERBundle to change the password

Postby dadaw36 » Thu May 31, 2012 9:10 pm

thank you for answering :)

well, i search into the bundle files, and i didn't found how to use the form type , because i don't wanna create a form for this , i want to use the hall function of the FOS with my View and my session, so i can have in the same page , the form of CHangePassword and other thing from the database .

maybe if you know how to get the session in the FosUserBundle controller we can fixe the problem !?!
dadaw36
Junior Member
 
Posts: 3
Joined: Thu May 31, 2012 11:38 am


Return to Bundles discussion

Who is online

Users browsing this forum: No registered users and 0 guests