From 943972690e9fbac3201ce38ff700ef37fe488285 Mon Sep 17 00:00:00 2001 From: Duy Le <71242963+duyle-py@users.noreply.github.com> Date: Tue, 14 May 2024 00:23:24 +0700 Subject: [PATCH] fix password resets (#741) --- app/controllers/password_resets_controller.rb | 3 ++- app/views/password_resets/edit.html.erb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/password_resets_controller.rb b/app/controllers/password_resets_controller.rb index 7b8b7091..6e86eb9d 100644 --- a/app/controllers/password_resets_controller.rb +++ b/app/controllers/password_resets_controller.rb @@ -3,7 +3,7 @@ class PasswordResetsController < ApplicationController layout "auth" - before_action :set_user_by_token, only: :update + before_action :set_user_by_token, only: %i[ edit update ] def new end @@ -20,6 +20,7 @@ class PasswordResetsController < ApplicationController end def edit + @user = User.new end def update diff --git a/app/views/password_resets/edit.html.erb b/app/views/password_resets/edit.html.erb index 26823dc6..1a4b6260 100644 --- a/app/views/password_resets/edit.html.erb +++ b/app/views/password_resets/edit.html.erb @@ -2,7 +2,7 @@ header_title t(".title") %> -<%= form_with url: password_reset_path(token: params[:token]), html: {class: "space-y-6"} do |form| %> +<%= form_with model: @user, url: password_reset_path(token: params[:token]), method: :patch, html: {class: "space-y-6"} do |form| %> <%= auth_messages form %>