You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: password.rb
    path of file: ./repos/onebody/app/models/concerns/person
    
    the code of the file until where you have to start completion: require 'active_support/concern'

module Concerns
  module Person
    module Password
      extend ActiveSupport::Concern

     
    
        def authenticate(email, password)
          people = undeleted.where(email: email.downcase)
          if people.exists?
            people.each do |person|
              if person.password_hash
                return person if person.password_hash == BCrypt::Engine.hash_secret(password, person.password_salt)
              elsif person.encrypted_password
                if person.encrypted_password == legacy_password_hash(password, person.salt)
                  person.password = person.password_confirmation = password
                  person.save(validate: false)
                  return person
                end
              end