PhoenixKit.Migrations.Postgres.V143 (phoenix_kit v1.7.199)

Copy Markdown View Source

V143: Known-device history for new-login security alerts.

phoenix_kit_user_known_devices remembers the (IP, hashed user-agent) pairs a user has previously signed in from. PhoenixKitWeb.Users.Auth .log_in_user/3 checks this table on every login; an unrecognized pair is a "new device" and — when the new_login_alert_enabled setting is on — logs a user.new_login_detected activity entry and sends an email via PhoenixKit.Users.Auth.UserNotifier.deliver_new_login_alert/2.

The user agent is stored pre-hashed (SHA-256 hex, matching PhoenixKit.Utils.SessionFingerprint.hash_user_agent/1) — the raw UA string is never persisted, only enough to recognize a repeat visit from the same browser/OS combination.

Summary

Functions

down(opts)

up(opts)