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
change_user_registration(user, attrs \\ %{})
Returns an %Ecto.Changeset{} for tracking user changes.
examples
Examples
iex> change_user_registration(user)
%Ecto.Changeset{data: %User{}}
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.
delete_session_token(token)
Deletes the signed token with the given context.
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}
generate_user_session_token(user)
Generates a session token. (this may be a good area for the API call to get the token)
get_user!(id)
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)
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
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
get_user_by_session_token(token)
Gets the user with the given signed token.
register_user(attrs)
Registers a user.
examples
Examples
iex> register_user(%{field: value})
{:ok, %User{}}
iex> register_user(%{field: bad_value})
{:error, %Ecto.Changeset{}}