lynndylanhurley / ng-token-auth

Token based authentication module for angular.js.
Do What The F*ck You Want To Public License
1.8k stars 233 forks source link

Password Reset "redirect_url" Confusion #249

Open MatthewVita opened 8 years ago

MatthewVita commented 8 years ago

When a user requests a password reset via the $auth.requestPasswordReset method, I'd like for the email link to include a redirect_url to go along with it (as seen in the demo app).

Let's say my base configuration has passwordResetSuccessUrl set to www.google.com as a test. According to these few lines of code https://github.com/lynndylanhurley/ng-token-auth/blob/efe9660b31c348b05768fd9b35b23783a001c0cb/src/ng-token-auth.coffee#L237-L241 and my understanding of the docs [0], the redirect_url should be put into the email link's query string. However, I only get a link of the following form:

http://localhost:3000/dashboard/users/password/edit?reset_password_token={token_here}

I do, however, see "www.google.com" in the redirect-url email header.

What am I doing wrong? Is there a value I should be setting on the Rails side for this?

[0] 'passwordResetSuccessUrl is the URL to which the API should redirect after users visit the links contained in password-reset emails."

Thanks!

UPDATE:

This is fixed by "You will probably want to override the default email templates for email sign-up and password-reset confirmation.": https://github.com/lynndylanhurley/devise_token_auth/#email-template-overrides - However, the route is not looking very good (note that the angular foobarRoute is put at the very end, which voids the ability to inspect the query string with $routeParams):

http://localhost:3000/?client_id={client_id}&config=default&expiry=&reset_password=true&token={token}&uid={uid}#/foobarRoute

...is this a known issue?

paulius005 commented 8 years ago

I was running into this as well, just hacked around it, now dealing with issues after upgrading devise_token_auth to 0.1.37 sigh