パスワードのリセットがうまくいかない
WebBrickのログみたらこんななってた
User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = ? ORDER BY "users"."id" ASC LIMIT 1 [["reset_password_token", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]]
う、うん。。。
とりあえず時間ないので以下の方法で対応した。
controllerを生成
rails g devise:controllers users
app/controllers/users/passwords_controller.rb
を編集
passwords_controller.rb
def create
# self.resource = resource_class.send_reset_password_instructions(resource_params)
self.resource = User.where(:email => resource_params['email']).send_reset_password_instructions(resource_params)
logger.debug self.resource.inspect
yield resource if block_given?
if successfully_sent?(resource)
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name))
else
respond_with(resource)
end
end
これで一応うまくいったんだけど自分でこう書かないとパスワードリセットできないのかな....