ruby on rails - Devise: edit_password_url in password reset email is sending users to url/api/v1/ -


i have rails app , devise set use json api user registration , login. side effect edit_password_url in password reset email accidentally sending users to:

 http://localhost:3000/api/v1/password/edit?reset_password_token=zzypcgmspn2964enukss  

when shouldn't have api/v1/, , should send them to:

http://localhost:3000/password/edit?reset_password_token=zzypcgmspn2964enukss 

i've been looking, can't figure out fix this.

i've created following:

api::v1::sessionscontroller < devise::sessionscontroller  

and

api::v1::registrationscontroller < registrationscontroller 

i have regular registrationscontroller inherits devise, not regular sessionscontroller, inherit straight devise there.

thanks help!

edit:

routes.rb

namespace :api, defaults: {format: 'json'}     namespace :v1       resources :users       devise_for :users, :path => '', path_names: {sign_in: "login", sign_out: "logout"},                                       controllers: {  omniauth_callbacks: "authentications", registrations: "registrations"}     end   end  devise_for :users, :path => '', path_names: {sign_in: "login", sign_out: "logout"},                                   controllers: {  omniauth_callbacks: "authentications", registrations: "registrations"}    resources :users 

edit 2: rake routes output

        new_api_v1_user_session      /api/v1/login(.:format)                                    api/v1/sessions#new {:format=>"json"}             api_v1_user_session post     /api/v1/login(.:format)                                    api/v1/sessions#create {:format=>"json"}     destroy_api_v1_user_session delete   /api/v1/logout(.:format)                                   api/v1/sessions#destroy {:format=>"json"}  api_v1_user_omniauth_authorize get|post /auth/:provider(.:format)                                  authentications#passthru {:provider=>/twitter|facebook/, :format=>"json"}   api_v1_user_omniauth_callback get|post /auth/:action/callback(.:format)                           authentications#(?-mix:twitter|facebook) {:format=>"json"}            api_v1_user_password post     /api/v1/password(.:format)                                 api/v1/passwords#create {:format=>"json"}        new_api_v1_user_password      /api/v1/password/new(.:format)                             api/v1/passwords#new {:format=>"json"}       edit_api_v1_user_password      /api/v1/password/edit(.:format)                            api/v1/passwords#edit {:format=>"json"}                                 put      /api/v1/password(.:format)                                 api/v1/passwords#update {:format=>"json"} cancel_api_v1_user_registration      /api/v1/cancel(.:format)                                   registrations#cancel {:format=>"json"}        api_v1_user_registration post     /api/v1(.:format)                                          registrations#create {:format=>"json"}    new_api_v1_user_registration      /api/v1/sign_up(.:format)                                  registrations#new {:format=>"json"}   edit_api_v1_user_registration      /api/v1/edit(.:format)                                     registrations#edit {:format=>"json"}                                 put      /api/v1(.:format)                                          registrations#update {:format=>"json"}                                 delete   /api/v1(.:format)                                          registrations#destroy {:format=>"json"}                        sessions      /sessions(.:format)                                        sessions#index                                 post     /sessions(.:format)                                        sessions#create                     new_session      /sessions/new(.:format)                                    sessions#new                    edit_session      /sessions/:id/edit(.:format)                               sessions#edit                         session      /sessions/:id(.:format)                                    sessions#show                                 put      /sessions/:id(.:format)                                    sessions#update                                 delete   /sessions/:id(.:format)                                    sessions#destroy                 authentications      /authentications(.:format)                                 authentications#index                                 post     /authentications(.:format)                                 authentications#create              new_authentication      /authentications/new(.:format)                             authentications#new             edit_authentication      /authentications/:id/edit(.:format)                        authentications#edit                  authentication      /authentications/:id(.:format)                             authentications#show                                 put      /authentications/:id(.:format)                             authentications#update                                 delete   /authentications/:id(.:format)                             authentications#destroy                 new_user_session      /login(.:format)                                           devise/sessions#new                    user_session post     /login(.:format)                                           devise/sessions#create            destroy_user_session delete   /logout(.:format)                                          devise/sessions#destroy         user_omniauth_authorize get|post /auth/:provider(.:format)                                  authentications#passthru {:provider=>/twitter|facebook/}          user_omniauth_callback get|post /auth/:action/callback(.:format)                           authentications#(?-mix:twitter|facebook)                   user_password post     /password(.:format)                                        devise/passwords#create               new_user_password      /password/new(.:format)                                    devise/passwords#new              edit_user_password      /password/edit(.:format)                                   devise/passwords#edit                                 put      /password(.:format)                                        devise/passwords#update        cancel_user_registration      /cancel(.:format)                                          registrations#cancel               user_registration post     /                                                          registrations#create           new_user_registration      /sign_up(.:format)                                         registrations#new          edit_user_registration      /edit(.:format)                                            registrations#edit                                 put      /                                                          registrations#update                                 delete   /                                                          registrations#destroy 

edit 3:

so i've been testing thing out, , in devise email template, path edit_password_url there, , works generate above wrong url, when rake routes, edit_user_password_url exists.

looking @ devise controller url helpers doc (found here), would've used:

edit_password_path(:user) translates edit_user_password_path. path seems interchangeable url.

i'm not 100% line defines method called edit_password_path whereas line creates route in devise context...


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -