Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route not found from link in email password reset #324

Open
epaillous opened this issue Aug 3, 2015 · 6 comments
Open

route not found from link in email password reset #324

epaillous opened this issue Aug 3, 2015 · 6 comments

Comments

@epaillous
Copy link

I' am trying use the password reset function of devise in a mobile application.
I'm calling http://{{url}}/auth/password, with
email ="my email"
redirect_url = "http://{{url}}/auth/password/edit" (where {url} is my server url)
I receive the email, but when I try the link inside it, I'm getting "Routing Error".

In my logs I have :
Completed 302 Found in 93ms (ActiveRecord: 2.9ms) so the redirection worked

and then
Started GET "/auth/password/edit" for ::1 at 2015-08-03 17:45:37 +0200
Processing by DeviseTokenAuth::PasswordsController#edit as HTML
Completed 404 Not Found in 3ms (ActiveRecord: 0.0ms)

ActionController::RoutingError (Not Found):
devise_token_auth (0.1.31) app/controllers/devise_token_auth/passwords_controller.rb:100:in `edit'

If I subclass passwords_controller (in overrides/passwords_controller.rb), copy/paste almost all the code from the original devise passwords controller and add :
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
passwords: 'overrides/passwords'
}
everything works fine.
Am I doing something wrong ? I just want the link to redirect on the classic devise page to reset password

I'm using Rails 4.2.1 and Devise 3.3

@booleanbetrayal
Copy link
Collaborator

Does upgrading to 0.1.32 resolve your issue?

@epaillous
Copy link
Author

If I upgrade to 0.1.32, when I try the link in the mail I just get :
{
success: false
}

It seems that the request is working :

Started GET "/auth/password/edit?config=default&redirect_url=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fpassword%2Fedit&reset_password_token=[FILTERED]" for ::1 at 2015-08-10 15:06:11 +0200
Processing by DeviseTokenAuth::PasswordsController#edit as HTML
Parameters: {"config"=>"default", "redirect_url"=>"http://localhost:3000/auth/password/edit", "reset_password_token"=>"[FILTERED]"}

And then the redirection is :

Redirected to http://localhost:3000/auth/password/edit?client_id=PDnSTmp_1UPoNrNN8fpyWA&config=default&expiry=&reset_password=true&token=2hDpQFbjNwKv4GukOAg3ZA&uid=test0c%40mail.com
Completed 302 Found in 93ms (ActiveRecord: 2.9ms)

Started GET "/auth/password/edit?client_id=PDnSTmp_1UPoNrNN8fpyWA&config=default&expiry=&reset_password=[FILTERED]&token=2hDpQFbjNwKv4GukOAg3ZA&uid=test0c%40mail.com" for ::1 at 2015-08-10 15:06:11 +0200
Processing by DeviseTokenAuth::PasswordsController#edit as HTML
Parameters: {"client_id"=>"PDnSTmp_1UPoNrNN8fpyWA", "config"=>"default", "expiry"=>"", "reset_password"=>"[FILTERED]", "token"=>"2hDpQFbjNwKv4GukOAg3ZA", "uid"=>"test0c@mail.com"}

I am expecting to have the default devise view to reset password. I get the same result if I give an empty redirect_url.

@vipin8169
Copy link

I am not getting the redirect url in the e-mail, although I am sending it as a param in the POST request to{{url}}/api/v1/auth/password.
"http://localhost/api/v1/auth/password/edit?reset_password_token=sJXUhFQSgDMvfoQ7RqRz"

@godinezb
Copy link

Just like @vipin8169, I'm facing the same issue my redirect_url is nor working. I opened issue #789.

@hamzaaltaf
Copy link

any solution to this issue?

@Polidoro
Copy link

I just spent a long time beating my head against this so I wanted to try to save others the headache if I can. The "Route not found" is a misleading error, it occurs even when the problem is something totally unrelated to the route.

This is the conditional that was failing for me:
https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/controllers/devise_token_auth/passwords_controller.rb#L41

That raises raise ActionController::RoutingError, 'Not Found' for some reason, even though the problem could be any number of non-routing issues.

I'd suggest confirming that your DeviseTokenAuth.default_password_reset_url and reset_password_token params and values match the params in the GET call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants