Pow v0.1.0-alpha Pow.Ecto.Schema behaviour View Source

Handles the Ecto schema for user.

Usage

Configure lib/my_project/user/user.ex the following way:

defmodule MyApp.Users.User do
  use Ecto.Schema
  use Pow.Ecto.Schema,
    login_field: :email,
    password_hash_methods: {&Pow.Ecto.Schema.Changeset.pbkdf2_hash/1,
                            &Pow.Ecto.Schema.Changeset.pbkdf2_verify/2}

  schema "users" do
    field :custom_field, :string

    pow_user_fields()

    timestamps()
  end

  def changeset(user_or_changeset, attrs) do
    pow_changeset(user, attrs)
  end
end

Remember to add user: MyApp.Users.User to configuration.

Link to this section Summary

Link to this section Functions

Link to this function login_field() View Source
login_field() :: atom()
Link to this function login_field(config) View Source
login_field(Keyword.t()) :: atom()
login_field(module()) :: atom()
Link to this macro pow_user_fields() View Source (macro)
pow_user_fields() :: Macro.t()

Link to this section Callbacks

Link to this callback changeset(arg0, map) View Source
changeset(Ecto.Schema.t() | Changeset.t(), map()) :: Changeset.t()
Link to this callback verify_password(arg0, binary) View Source
verify_password(Ecto.Schema.t(), binary()) :: boolean()