ores.iam.login_info

Table of Contents

Login tracking and security state for one account: the last successful login, the running failed-attempt count, the lock and online flags, the forced password-reset flag, and the IP address of the last success and the last attempt. One row per account, keyed by account_id.

The table is current-state (see projects/ores.sql/create/iam/iam_login_info_create.sql): it carries no valid_from=/=valid_to, no GIST exclusion, no version column and no audit tail, unlike the bi-temporal tables every other domain_entity in this component generates. The :current_state: flag in the * SQL ** Flags drawer selects that shape. Three suppressions keep the generated DDL at exactly the constraints the hand-written table has: :skip_uuid_check: on account_id drops the nil-UUID check, :skip_check: on the account foreign key drops the account existence check, and the * SQL ** Indexes drawer restates the three hand-written indexes so none is lost.

1. Flags

2. Natural keys

3. Columns

3.1. account_id

The account this login state belongs to. It is the primary key, so the table holds exactly one row per account.

3.2. last_ip

IP address the account last logged in from successfully.

boost::asio::ip::make_address("127.0.0.1")

3.3. last_attempt_ip

IP address of the most recent login attempt, successful or failed.

boost::asio::ip::make_address("127.0.0.1")

3.4. failed_logins

Count of consecutive failed login attempts since the last success.

3.5. locked

Flag indicating whether the account is locked for security reasons.

3.6. last_login

Timestamp of the last successful login.

ctx.past_timepoint()

3.7. online

Flag indicating whether the account is currently logged in.

3.8. password_reset_required

Flag indicating the user must change their password on the next login.

Set by an admin when resetting a password; cleared after the user sets a new one.

4. SQL

4.1. Flags

4.2. Indexes

name columns unique current_only where_extra
tenant tenant_id false false  
account_id account_id false false  
locked locked false false locked = false

5. Foreign keys

5.1. account_id

Soft foreign key to the owning account.

6. C++

6.1. Flags

6.2. Repository

6.3. Domain includes

#include <chrono>
#include <boost/asio/ip/address.hpp>
#include <boost/uuid/uuid.hpp>

6.4. Entity includes

#include <string>
#include "sqlgen/Timestamp.hpp"
#include "sqlgen/PrimaryKey.hpp"

6.5. Conventions

6.6. Table display

column header
account_id Account
last_login Last Login
failed_logins Failed Logins
locked Locked
online Online
password_reset_required Password Reset Req.
last_ip Last IP
last_attempt_ip Last Attempt IP

6.7. Presentation

The screen's declaration. account_id is the primary key and the natural identity both, so the route's path segment carries the account and the form offers it as the one required field. The row is read-only: the service writes it as a side effect of signing in, so the screen shows security state rather than accepting it.

6.7.1. Detail fields

field label widget type is_key is_required placeholder
account_id Account accountEdit line_edit true true Enter the account identifier
last_login Last Login lastLoginEdit date      
failed_logins Failed Logins failedLoginsEdit spin_box      
locked Locked lockedEdit check_box      
online Online onlineEdit check_box      
password_reset_required Password Reset Required passwordResetRequiredEdit check_box      
last_ip Last IP lastIpEdit line_edit      
last_attempt_ip Last Attempt IP lastAttemptIpEdit line_edit      

6.7.2. Columns

enum_name field header type width
AccountId account_id Account string 300
LastLogin last_login Last Login timestamp 160
FailedLogins failed_logins Failed Logins int 100
Locked locked Locked boolean 80
Online online Online boolean 80
PasswordResetRequired password_reset_required Password Reset Req. boolean 140
LastIp last_ip Last IP string 140
LastAttemptIp last_attempt_ip Last Attempt IP string 140

6.8. Paste blocks

7. See also

  • ores.iam — component group overview.

Emacs 29.3 (Org mode 9.6.15)