php - Symfony2 decode and compare pass -
I need to create a form:
- when I select a user from the list I will get an input where the user will be able to write the password (for the selected user)
- And if I agree with the passwords from the database, I should compare it. I found a solution on the stack. But I am asking, what is the other way to make Mebayri? any idea?
Here's what I've already done:
Controller:
Public function UserAction ( Request $ request) {$ form = $ this- & gt; CreateForm (new UserIncType ()); If ($ request-> method is ('post')) {$ form-> Tie ($ request); If ($ form-> isValid ()) {$ valuePass = $ form-> Receive ('password') - & gt; GetData (); $ ValueUser = $ form & gt; Get ('user') - & gt; GetData (); $ Security_encoder = null; $ UserRepo = $ this- & gt; GetDoctrine () - & gt; GetRepository ('Mancor bundle: user'); $ User = $ userRepo- & gt; FindById ($ valueUser); $ Security_encoder = $ this- & gt; Get ('security.encoder_factory') - & gt; GetEncoder ($ user); $ Password = $ request- & gt; Get ('password'); } $ This- & gt; Redirect ($ -> - UserUrl ('permit_show')); }
How to decode the interpretation passed from the database and pass it near?
Or is there any other way to make it?
Comments
Post a Comment