I have made a new rails-api app, integrated devise_auth_token in it. At the moment signup,forgot password is working. But cant get reset password to work.
The confirmation url sent in the mail gives success:false response.
Below is the confirmation url
Here is the server log of reset email
Started GET "/auth/password/edit?config=default&redirect_url=foo&reset_password_token=[FILTERED]" for ::1 at 2015-09-24 14:41:21 +0530 Processing by DeviseTokenAuth::PasswordsController#edit as /
Parameters: {"config"=>"default", "redirect_url"=>"foo", "reset_password_token"=>"[FILTERED]"} Unpermitted parameters: config, redirect_url User Load (0.2ms) SELECTusers
.* FROMusers
WHEREusers
.reset_password_token
= '0b3dfdf3a80dce289df8c2cb16c528614b302534264e85e747c4f6b51583da15' ORDER BYusers
.id
ASC LIMIT 1 Completed 404 Not Found in 5ms (Views: 0.3ms | ActiveRecord: 0.2ms)Here is the confirmation email which is getting sent on password reset.
Started POST "/auth/[email protected]&redirect_url=foo" for ::1 at 2015-09-24 14:04:05 +0530 Processing by
DeviseTokenAuth::PasswordsController#create as / Parameters: {"email"=>"[email protected]", "redirect_url"=>"foo"} Unpermitted parameter: redirect_url Unpermitted parameter: redirect_url User Load (66.5ms) SELECT
users
.* FROMusers
WHERE (BINARY uid = '[email protected]' AND provider='email') ORDER BYusers
.id
ASC LIMIT 1 User Load (9.8ms) SELECTusers
.* FROMusers
WHEREusers
.reset_password_token
= '0b3dfdf3a80dce289df8c2cb16c528614b302534264e85e747c4f6b51583da15' ORDER BYusers
.id
ASC LIMIT 1 (0.1ms) BEGIN SQL (17.7ms) UPDATEusers
SETreset_password_token
= '0b3dfdf3a80dce289df8c2cb16c528614b302534264e85e747c4f6b51583da15',reset_password_sent_at
= '2015-09-24 08:34:05',updated_at
= '2015-09-24 08:34:05' WHEREusers
.id
= 6 (63.9ms) COMMIT
Rendered /home/anjan/.rvm/gems/ruby-2.2.3/gems/devise_token_auth-0.1.34/app/views/devise/mailer/reset_password_instructions.html.erb (16.2ms)Devise::Mailer#reset_password_instructions: processed outbound mail in 424.3ms
Sent mail to [email protected] (64.4ms) Date: Thu, 24 Sep 2015 14:04:06 +0530 From: [email protected] Reply-To: [email protected] To: [email protected] Message-ID: <[email protected]> Subject: Reset password instructions Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit email: [email protected] provider: email redirect-url: foo client-config: default
Hello [email protected]!
Someone has requested a link to change your password. You can do this through the link below.
Change my password
If you didn't request this, please ignore this email.
Your password won't change until you access the link above and create a new one.
Completed 200 OK in 979ms (Views: 0.6ms | ActiveRecord: 158.1ms)
Guys would appreciate nay help with this. Even is it any issue the token sent in mail is different form the one generated.? is this suposed to be this way.
Below is my User model.
{"token"=>"$2a$10$l766Mu/s8IUIHi9r3sz40ODQk2R.YDo283JQ.82Lijb3fjJ5Unqgq", "expiry"=>1444283710}, "H2Cqp2kIt56BYikqXp1HgA"=>{"token"=>"$2a$10$upMCA8ZKLXvq9VjVaz2Vp.sZu7zr2lSTCFrxWnBmg4wC2gQrW9sIW", "expiry"=>1444293849}}, created_at: "2015-09-24 05:55:10", updated_at: "2015-09-24 08:44:09">
Here is my User model file as below
class User < ActiveRecord::Base
# Include default devise modules.
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
include DeviseTokenAuth::Concerns::User
#Deleted ":confirmable," from above
end
Below is my schema.
ActiveRecord::Schema.define(version: 20150921074353) do
create_table "users", force: :cascade do |t|
t.string "provider", limit: 255, default: "email", null: false
t.string "uid", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", limit: 4, default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email", limit: 255
t.string "name", limit: 255
t.string "nickname", limit: 255
t.string "image", limit: 255
t.string "email", limit: 255
t.text "tokens", limit: 65535
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["uid", "provider"], name: "index_users_on_uid_and_provider", unique: true, using: :btree
end
My PasswordController file is as below:
class PasswordController < ApplicationController
config.action_controller.action_on_unpermitted_parameters = :log
end