Pbkdf2.check_pass

You're seeing just the function check_pass, go back to Pbkdf2 module for more information.
Link to this function

check_pass(user, password, opts \\ [])

View Source

Checks the password, using verify_pass/2, by comparing the hash with the password hash found in a user struct, or map.

This is a convenience function that takes a user struct, or map, as input and seemlessly handles the cases where no user is found.

Options

  • :hash_key - the password hash identifier
    • this does not need to be set if the key is :password_hash or :encrypted_password
  • :hide_user - run the no_user_verify/1 function if no user is found
    • the default is true

Example

The following is an example of using this function to verify a user's password:

def verify_user(%{"password" => password} = params) do
  params
  |> Accounts.get_by()
  |> check_pass(password)
end

The Accounts.get_by function in this example takes the user parameters (for example, email and password) as input and returns a user struct or nil.