Skip to content

Commit

Permalink
more nil checking
Browse files Browse the repository at this point in the history
  • Loading branch information
compwron committed Jan 13, 2025
1 parent b65f108 commit cbd4239
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class Users::PasswordsController < Devise::PasswordsController

def create
@email = params.dig(resource_name, :email)
@phone_number = params[resource_name][:phone_number]
@resource = @email.blank? ? User.find_by(phone_number: @phone_number) : User.find_by(email: @email)
@phone_number = params.dig(resource_name, :phone_number)

unless valid_params?(@email, @phone_number)
render_error
return if @errors
end
@resource = @email.blank? ? User.find_by(phone_number: @phone_number) : User.find_by(email: @email)

send_password
redirect_to after_sending_reset_password_instructions_path_for(resource_name),
Expand Down

0 comments on commit cbd4239

Please sign in to comment.