concept Auction in category elixir

This is an excerpt from Manning's book Phoenix in Action.
In the Auction module, add the following function definition.
The first step you need to take in this chapter is to define what a user is. Will they have usernames or just an email address? What information will you collect about them? These are decisions that you need to make before you allow user registration. And for the most part, these choices will be implemented on the Auction side of your umbrella application (as opposed to the Phoenix-focused AuctionWeb side).
There are three things you need to do in Auction before you move back over to Phoenix:
To look up a user based on the submitted username and password, you also need to implement a new function in the Auction API module. This function should return the Auction.User if one is found, or return false (or, really, anything else) if one isn’t found.
In keeping with the spirit of having your modules worry about as few things as possible, you’ll offload the password-hashing activities to the Auction.Password module. You’ll implement those functions momentarily. For now, let’s write the other functionality in the Auction.get_user_by_username_and_password/2 function.
Listing 10.19. Implementing Auction.get_user_by_username_and_password/2
defmodule Auction do alias Auction.{Repo, Item, User, Password} #1 @repo Repo # ... def get_user_by_username_and_password(username, password) do with user when not is_nil(user) <- @repo.get_by(User, %{username: username}), true <- Password.verify_with_hash(password, user.hashed_password) do user else _ -> Password.dummy_verify end end endYou now know enough about how your functions will work that you can implement Auction.Password.verify_with_hash/2 and Auction.Password.dummy_verify/0. Just like Auction.Password.hash/1, your functions will be simple wrappers around functions provided by your hashing package of choice, pbkdf2_elixir. The following listing shows the full module.