Coherence.TrackableService (Coherence v0.8.0)
Trackable tracks login information for each login.
You have two choices to track logins.
- Add trackable fields to your user schema.
- 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
conn()
@type conn() :: Plug.Conn.t()
params()
@type params() :: map()
schema()
@type schema() :: Ecto.Schema.t()
Functions
track(conn, user, action)
track_failed_login(conn, user, arg3)
track_lock(conn, user, bool)
track_login(conn, user, bool1, bool2)
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.
track_logout(conn, user, bool1, bool2)
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.