AzureBillingDashboard.Accounts (azure_billing_dashboard v0.2.0)

The Accounts context.

Link to this section Summary

Functions

Returns an %Ecto.Changeset{} for tracking user changes.

Confirms a user by the given token.

Deletes the signed token with the given context.

Delivers the confirmation email instructions to the given user.

Generates a session token. (this may be a good area for the API call to get the token)

Gets a single user.

Gets a user by email.

Gets a user by email and password.

Gets the user with the given signed token.

Registers a user.

Link to this section Functions

Link to this function

change_user_registration(user, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking user changes.

examples

Examples

iex> change_user_registration(user)
%Ecto.Changeset{data: %User{}}
Link to this function

confirm_user(token)

Confirms a user by the given token.

If the token matches, the user account is marked as confirmed and the token is deleted.

Link to this function

delete_session_token(token)

Deletes the signed token with the given context.

Link to this function

deliver_user_confirmation_instructions(user, confirmation_url_fun)

Delivers the confirmation email instructions to the given user.

examples

Examples

iex> deliver_user_confirmation_instructions(user, &Routes.user_confirmation_url(conn, :edit, &1))
{:ok, %{to: ..., body: ...}}

iex> deliver_user_confirmation_instructions(confirmed_user, &Routes.user_confirmation_url(conn, :edit, &1))
{:error, :already_confirmed}
Link to this function

generate_user_session_token(user)

Generates a session token. (this may be a good area for the API call to get the token)

Gets a single user.

Raises Ecto.NoResultsError if the User does not exist.

examples

Examples

iex> get_user!(123)
%User{}

iex> get_user!(456)
** (Ecto.NoResultsError)
Link to this function

get_user_by_email(email)

Gets a user by email.

examples

Examples

iex> get_user_by_email("foo@example.com")
%User{}

iex> get_user_by_email("unknown@example.com")
nil
Link to this function

get_user_by_email_and_password(email, password)

Gets a user by email and password.

examples

Examples

iex> get_user_by_email_and_password("foo@example.com", "correct_password")
%User{}

iex> get_user_by_email_and_password("foo@example.com", "invalid_password")
nil
Link to this function

get_user_by_session_token(token)

Gets the user with the given signed token.

Link to this function

register_user(attrs)

Registers a user.

examples

Examples

iex> register_user(%{field: value})
{:ok, %User{}}

iex> register_user(%{field: bad_value})
{:error, %Ecto.Changeset{}}