Skip to content

Comments

Add last login tracking to admin user management#77

Merged
thehack904 merged 4 commits intomainfrom
copilot/add-last-login-timestamp
Feb 15, 2026
Merged

Add last login tracking to admin user management#77
thehack904 merged 4 commits intomainfrom
copilot/add-last-login-timestamp

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Implements user activity tracking by recording and displaying last login timestamps in the admin panel.

Changes

  • Database: Added last_login TEXT column to users table with ALTER TABLE migration for existing databases
  • Authentication: Login route now records UTC timestamp (ISO 8601) on successful authentication
  • User Model: Extended to include last_login field; updated all user queries accordingly
  • Admin UI: Added "Last Login" column to manage_users table with human-readable formatting (YYYY-MM-DD HH:MM:SS UTC)
  • Template Filter: Added format_datetime filter to convert ISO timestamps; displays "Never" for null values

Implementation

# On successful login
with sqlite3.connect(DATABASE, timeout=10) as conn:
    c = conn.cursor()
    c.execute('UPDATE users SET last_login=? WHERE username=?',
              (datetime.now(timezone.utc).isoformat(), username))
    conn.commit()

Screenshot

Manage Users Panel

Shows three users with different login states: recent login, older login, and never logged in.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • iptv.lan
    • Triggering command: /usr/bin/python3 python3 app.py (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Display last login time on admin panel</issue_title>
<issue_description>Add a feature to the admin panel that shows the last login time for each user. This involves:

  • Adding a 'last_login' timestamp field to the user database
  • Updating authentication logic to update last_login on sign-in
  • Display the timestamp in the admin user management interface
    This improves visibility for admins and supports user activity tracking.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 14, 2026 20:15
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
…prove timestamp handling

Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot AI changed the title [WIP] Add last login time display to admin panel Add last login tracking to admin user management Feb 14, 2026
Copilot AI requested a review from thehack904 February 14, 2026 20:22
Copy link
Owner

@thehack904 thehack904 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files have been reviewed and tested. Code works and is good to go.

@thehack904 thehack904 marked this pull request as ready for review February 15, 2026 01:43
@thehack904 thehack904 merged commit 5171131 into main Feb 15, 2026
1 check passed
@thehack904 thehack904 deleted the copilot/add-last-login-timestamp branch February 15, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display last login time on admin panel

2 participants