Coherence v0.5.1 Coherence.TrackableService

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—trackableand—trackable-table` installation options are mutually exclusive.

Link to this section Summary

Link to this section Types

Link to this type conn()
conn() :: Plug.Conn.t()
Link to this type params()
params() :: Map.t()
Link to this type schema()
schema() :: Ecto.Schema.t()

Link to this section Functions

Link to this function track(conn, user, action)
Link to this function track_failed_login(conn, user, arg3)
track_failed_login(conn(), schema(), boolean()) :: conn()
Link to this function track_lock(conn, user, bool)
track_lock(conn(), schema(), boolean()) :: conn()
Link to this function track_login(conn, user, bool1, bool2)
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)
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_atand current_sign_in_ip' fields. A value of true in the third argument indicates that the:trackable optionis 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)
track_password_reset(conn(), schema(), boolean()) :: conn()
Link to this function track_unlock(conn, user, bool)
track_unlock(conn(), schema(), boolean()) :: conn()
Link to this function track_unlock_token(conn, user, bool)
track_unlock_token(conn(), schema(), boolean()) :: conn()