Dieses Blog durchsuchen

Sonntag, 10. Juli 2016

Symfony 3.1 Add a encrypted passwordfield to your entity, controller and Form

If you have a passwordfield in your database you have to encrypt the passwordbefpre you can save it.

this task is pretty straight forward in symfony 3.1

Once you have created your entity (f. i BlogBundle\Entity\Users)
You have to implement the core security user  interface  to make the entity compatible to the encoder class. See my class to understand the mechanism:


Implement interfacemethods
You have to implement the last 2 methods (see class above) to fullfill the contract.

Modify security:
open app/config/security and add encoder like this:

clear cache after that

Add encoder to your user-controller


Add password and password confirmation field to your crud form

thats it

Keine Kommentare:

Kommentar veröffentlichen