Coherence.TrackableService (Coherence v0.8.0)

Trackable tracks login information for each login.

You have two choices to track logins.

  1. Add trackable fields to your user schema.
  2. Create a separate trackable table.

User Schema Trackable Fields

Use the --trackable installation option to enable this feature.

Trackable adds the following fields to the user schema:

  • :sign_in_count - Increments each time a user logs in.
  • :current_sign_in_at - The time and date the user logged in.
  • :current_sign_in_ip - The IP address of the logged in user.
  • :last_sign_in_at: last_at - The previous login time and date
  • :last_sign_in_ip: last_ip - The previous login IP address

Trackable Table

This feature provides full audit capability around user logins.

Use the --trackable-table installation option to use a separate trackable table/schema.

Trackable-table creates a Trackable schema with the following fields:

  • :action - The action that generated the entry. Values are :login, :logout, :password_reset, :failed_login, :lock, :unlock, :unlock_token
  • :sign_in_count - Increments each time a user logs in.
  • :current_sign_in_at - The time and date the user logged in.
  • :current_sign_in_ip - The IP address of the logged in user.
  • :last_sign_in_at: last_at - The previous login time and date
  • :last_sign_in_ip: last_ip - The previous login IP address

Note, the --trackable and --trackable-table installation options are mutually exclusive.

Summary

Types

@type conn() :: Plug.Conn.t()
@type params() :: map()
@type schema() :: Ecto.Schema.t()

Functions

Link to this function

track(conn, user, action)

Link to this function

track_failed_login(conn, user, arg3)

@spec track_failed_login(conn(), schema(), boolean()) :: conn()
Link to this function

track_lock(conn, user, bool)

@spec track_lock(conn(), schema(), boolean()) :: conn()
Link to this function

track_login(conn, user, bool1, bool2)

@spec track_login(conn(), schema(), boolean(), boolean()) :: conn()

Track user login details.

Saves the ip address and timestamp when the user logs in.

A value of true in the third argument indicates that the :trackable option is configured. A Value of true in the fourth argument indicates that the :trackable_table is configured.

Link to this function

track_logout(conn, user, bool1, bool2)

@spec track_logout(conn(), schema(), boolean(), boolean()) :: conn()

Track user logout.

Updates the last_sign_in_at and last_sign_in_at fields. Clears the current_sign_in_at and current_sign_in_ip fields.

A value of true in the third argument indicates that the :trackable option is configured. A Value of true in the fourth argument indicates that the :trackable_table is configured.

Link to this function

track_password_reset(conn, user, bool)

@spec track_password_reset(conn(), schema(), boolean()) :: conn()
Link to this function

track_unlock(conn, user, bool)

@spec track_unlock(conn(), schema(), boolean()) :: conn()
Link to this function

track_unlock_token(conn, user, bool)

@spec track_unlock_token(conn(), schema(), boolean()) :: conn()