From fa76306d13fc6f26a96da577abc04a28148dde18 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 7 Feb 2023 11:22:32 +0000 Subject: [PATCH] refactor: simplify by removing before_action --- app/controllers/auth/passwords_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/auth/passwords_controller.rb b/app/controllers/auth/passwords_controller.rb index ea567e710..e0dda4e02 100644 --- a/app/controllers/auth/passwords_controller.rb +++ b/app/controllers/auth/passwords_controller.rb @@ -1,6 +1,5 @@ class Auth::PasswordsController < Devise::PasswordsController include Helpers::Email - before_action :set_minimum_password_length, only: %i[edit create] def reset_confirmation self.resource = resource_class.new @@ -20,11 +19,13 @@ class Auth::PasswordsController < Devise::PasswordsController self.resource = resource_class.send_reset_password_instructions(resource_params) yield resource if block_given? + @minimum_password_length = Devise.password_length.min respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) end def edit super + @minimum_password_length = Devise.password_length.min @confirmation = params["confirmation"] render "devise/passwords/reset_password" end @@ -52,10 +53,6 @@ class Auth::PasswordsController < Devise::PasswordsController protected - def set_minimum_password_length - @minimum_password_length = Devise.password_length.min - end - def set_2fa_required return unless resource.respond_to?(:need_two_factor_authentication?) && resource.need_two_factor_authentication?(request)