Forgot password function fosuserbundle - fosuserbundle

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.

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 :
Forgot password ?
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!

Related

how to redirect to home page from Servlet to JSP with Angular UI

I have an AngularJs UI login page and I'm posting the username and password details to a Servlet to validate, and when I'm returning back I'm using sendRedirect from Servlet but it's not working. Here is my sample code
In Servlet:
req.sendRedirect("NewFile.jsp");
It is displaying content inside NewFile.jsp within the login page itself instead of redirecting to NewFile.jsp
I have tried using "$window.location.href" inside AngularJs code but that itself didnt forward to home page.
Any help is much appreciated.
Thank you!
Acording of what you said in the comment of the bounty, I have to say that having everything in only one controller sounds like a bad idea, for more information about this and naming conventions go to Naming conventions and best practices
According to your question, maybe you need to give more details of the problem, it's not clear.
Have you tried to use $location module?
https://docs.angularjs.org/api/ng/service/$location
You can use de .path() module to redirect.
$location.path('#!/');
That will redirect you to the home page.

Dealing with %23 replacing id # in angular routing.

The problem:
I have a express backend/angularjs frontend web app hosting all of my teams documentation for our users. We frequently need to post links to a specific question (all linked as ids) to our users in Slack. ex. helpapp.com/productTheyNeedHelpWith#QuestionLinkedTo the problem is that when the link is clicked from slack, not when copy/pasted, Slack launches a new browser window/tab to helpapp.com/productTheyNeedHelpWith%23QuestionLinkedTo.
This breaks ngRoute as it no longer recognizes /productTheyNeedHelpWith as the path to load the correct page for and the user gets sent to our home page instead.
Thoughts on possible solutions:
I'd like to solve this issue either in the ngRouting itself by somehow updating the path by replacing %23 with # before $routeProvider does it's magic, or by somehow capturing the full url in app.js and updating it or redirect to an updated version before we've rendered a page view at all.
currently I've set a workaround by using a ng-init event to check the url and, if %23 is found, update it and replace it with the correct extension but this causes an odd double load that leads to a poor user experience.
Final Thoughts:
As I'm not sure of the best way to go about this, and because our code is proprietary, I'm avoiding posting to much 'example code' that may not be relevant but am happy to provide any parts of it that you, wonderful stackoverflowers, may request. Thank you in advance for your assistance.

Angular - Keep values input fields whilst user logs in

New to Angular - and I have a feeling this question more than likely already exists however I can't seem to find - so a duplicate question was not intended.
But.
I have a post button in my app, if the user is not logged in, on clicking post they are redirected the login page. After they login they are returned to the homepage however the fields they completed before they click Post are cleared. .
Can someone please point me to what Angular documentation I need to read to solve this issue.
Thanks.
I think you could set an object on $rootScope to contain the data so that it will not be lost between controllers and just map the fields from the view to the properties of the object you used in the $rootScope.
Please note that I'm not sure this is optimal or if it fits to any best practice.
I was assuming that by redirecting to a different page you mean that you are going to a different route which is handled by angular as part of the same SPA.

How to make a login page outside the single page application skeleton

I have an angularJS single page application. It is an admin dashboard. However I do not want anyone to access the dashboard unless he is logged in.
Problem that I am facing is when I create a login template, it is usually part of the admin dashboard, since it is a single page application. However I want the login page to look completely different from the single page application index default view. Same for registration page.
What are ways to make a page different completely from the skeleton of the single page application with angular ?
I am sorry if the question is broad but I am new to angular. I do not care about any code written I just would like to understand a good technique for a sort of thing.
Feel free to send me any articles or documentations that explains similar technique
If I am understanding your question correctly, what you need to do is the following.
Use ui-router to control the navigation (or routing) in your application. Note that ui-router will become native in AngularJS 2, right now you will need to use NPM or Bower to include it in your project.
Then use the events it provides to determine if the user needs to logon before accessing the given route. If logon is required you can redirect to the logon page, the redirect back upon successful authentication.

AngularJS unique slug validator directive

So currently, I am exploring the world of AngularJS and have encountered a problem.
I am building a very primitive blog application supported by Firebase, and I want to use Angular validation to check whether a slug is already in use. However, something is going wrong here. This is the directive that I wrote to check whether a slug is already in use (without Firebase):
http://jsfiddle.net/Lk6fY/1/
As you can see, this works like a charm. Now, I can insert the Firebase call here, instead of the primitive check, but this forms two problems:
On every keyup, a request would be send to Firebase. If this is an application for one user, this would not really be a problem, but imagine 5000 people at the same time trying to post a blog entry (which of course wouldn't happen, but I want to learn the right approach).
Nevertheless, I did try it, and it didn't really work as expected. I think it has to do with the response time to the Firebase servers, because:
foo-bar would be valid, until the user pressed the submit button, whereas foo-ba would be invalid, but after pressing the submit button the user could simply continue.
So therefore my question: how can this be solved in an efficient an appropriate manner?
Ideally, I would like the directive to connect to Firebase after either the title or slug fields are not anymore in focus. How would this be possible?

Resources