SqlMembershipProvider.Membership (sql_membership_provider v0.9.1)

Struct for representing a user's membership to an application and their authentication information.

Summary

Functions

Changeset for user registration

Fetch a membership by case insensitive email address and case insensitive application name

Fetch a membership by user id.

Check if a plaintext password matches a user's hashed password.

Changeset for resetting user password. This method has no authentication checks.

Changeset for changing user password authenticated by the current password

Types

@type t() :: %SqlMembershipProvider.Membership{
  __meta__: Ecto.Schema.Metadata.t(),
  application:
    Ecto.Schema.belongs_to(SqlMembershipProvider.Application.t()) | nil,
  application_id: binary() | nil,
  comment: String.t() | nil,
  create_date: DateTime.t() | nil,
  email: String.t() | nil,
  failed_password_answer_attempt_count: integer() | nil,
  failed_password_answer_attempt_window_start: DateTime.t() | nil,
  failed_password_attempt_count: integer() | nil,
  failed_password_attempt_window_start: DateTime.t() | nil,
  is_approved: boolean() | nil,
  is_locked_out: boolean() | nil,
  last_lockout_date: DateTime.t() | nil,
  last_login_date: DateTime.t() | nil,
  last_password_changed_date: DateTime.t() | nil,
  lowered_email: String.t() | nil,
  mobile_pin: String.t() | nil,
  new_password: String.t() | nil,
  password: String.t() | nil,
  password_answer: String.t() | nil,
  password_format: integer() | nil,
  password_question: String.t() | nil,
  password_salt: String.t() | nil,
  plaintext_password: String.t() | nil,
  user: Ecto.Schema.belongs_to(SqlMembershipProvider.User.t()) | nil,
  user_id: binary() | nil
}

Functions

Link to this function

create_changeset(model, params)

@spec create_changeset(t(), %{required(atom()) => any()}) :: Ecto.Changeset.t()

Changeset for user registration

Link to this function

find_by_email(email_address, application_name)

@spec find_by_email(String.t(), String.t()) :: Ecto.Query.t()

Fetch a membership by case insensitive email address and case insensitive application name

Link to this function

find_by_user_id(user_id)

@spec find_by_user_id(String.t()) :: Ecto.Query.t()

Fetch a membership by user id.

Link to this function

is_password_valid?(membership, password)

@spec is_password_valid?(
  t(),
  String.t()
) :: boolean()

Check if a plaintext password matches a user's hashed password.

Link to this function

password_reset_changeset(model, params \\ %{})

@spec password_reset_changeset(t(), %{required(atom()) => any()}) ::
  Ecto.Changeset.t()

Changeset for resetting user password. This method has no authentication checks.

Link to this function

password_update_changeset(model, params \\ %{})

@spec password_update_changeset(t(), %{required(atom()) => any()}) ::
  Ecto.Changeset.t()

Changeset for changing user password authenticated by the current password