Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forgot password function fosuserbundle

Tags:

I have been googling for a couple hours now and cannot find any information on how to implement the "Forgot Password" functionality in FOSUserBundle

Is this part of the bundle or is it something I have to create myself.

like image 886
smugford Avatar asked Nov 25 '13 01:11

smugford


People also ask

What is FOSUserBundle?

The FOSUserBundle adds support for a database-backed user system in Symfony2+. It provides a flexible framework for user management that aims to handle common tasks such as user registration and password retrieval. Features include: Users can be stored via Doctrine ORM or MongoDB/CouchDB ODM.


1 Answers

Actually it is weird that you didn't find anything about it, you probably didn't search with good terms (maybe reset instead of forgot). Anyway it's a pretty simple process. You probably read the github documentation, it's explained there (Step 6) that you have to import the routing.xml file and furthermore this route :

fos_user_resetting:     resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"     prefix: /resetting 

You just have to add a link in your template with the fos_user_resetting_request route :

<a href="{{ path('fos_user_resetting_request') }}">Forgot password ?</a> 

Then a click on this link will lead the user to a reset form which will ask the user email and send them an email with a security token in the link to the password edit form.

If you want to customize the render, read these docs :

  • Overriding templates
  • Overriding forms
  • Overriding controllers

Does it help you? Good luck!

like image 149
lenybernard Avatar answered Oct 24 '22 10:10

lenybernard