screen_lock_user_auto

User Based Automatic Screen Lock on Inactivity

Auto Lock Backend Screen Based on Idle Time

This module introduces an automatic screen lock feature in the Odoo backend based on user inactivity. It enhances system security by locking the users screen after a defined period of idle time. Each user has a personal timeout setting that determines when their screen should lock. Administrators can define a default timeout globally, which is applied only when new users are created. The locking mechanism runs in real time using Odoos modern JavaScript framework, ensuring both performance and security.


Main Features:

  • User Specific Timeout Settings:
  • Each user has a configurable screen timeout setting (in minutes) available on their user profile.This defines how long the user can remain inactive before the screen locks.
  • Default Timeout for New Users:
  • Administrators can define a default timeout from Settings.
  • This value is only used as the initial timeout value when new users are created.
  • Existing users are not affected when the global setting is changed.
  • Automatic Screen Lock Triggered by Inactivity:
  • The system tracks user activity (mouse movement, clicks, keypresses).
  • When the user is inactive for their defined timeout period, the screen automatically locks.
  • Frontend Based Lock Logic:
  • Lightweight JavaScript logic runs in the background to detect inactivity.
  • It checks the last activity timestamp at regular intervals without affecting performance.
  • Session Info Integration:
  • The users timeout setting is included in the session data returned from the server.
  • This ensures each user receives their personalized timeout value.
  • Cookie Based Lock Check:
  • A browser cookie ensures the screen is not locked multiple times unnecessarily.
  • The system checks this before triggering a lock action.
  • Custom OWL Service:
  • Screen locking is handled by a dedicated OWL based service, allowing smooth frontend integration.
  • Multi Tab Behavior (Screen Lock in One Tab Locks Others):
  • When working in multiple browser tabs with the same user account, the auto lock system treats each tab independently.
  • For example, if a user has 3 open tabs and their timeout is configured to 5 minutes:
  • If the user is only active in one tab, but inactive in the other two,
  • After 5 minutes, the inactive tabs may trigger the lock screen and set the shared cookie is_screen_locked to true.
  • As a result, even the active tab will show the locked screen immediately on page reload or next session check.
  • This ensures security consistency across tabs, but may lead to unexpected locking if only one tab remains active.

Workflow:

  • Install the App:
    • Once installed, the auto screen lock feature is enabled across the system.
  • Set Default Timeout (Optional):
    • Go to Settings > General Settings and configure a default timeout (in minutes).
    • This default will be applied only when new users are created.
  • Manage Per User Timeout:
    • Edit each users profile to set or adjust their individual screen timeout.
    • This gives flexibility to tailor locking behavior by role or responsibility.
  • Screen Auto Locks:
    • After the user is inactive for the configured time, their screen will auto lock.
    • This action is triggered by the frontend based on the last activity timestamp.
  • Unlocking:
    • Users can unlock the screen as per the logic provided in the main screen_lock_user module (e.g., using a PIN or password reauthentication).

Check App Here

odoo_video_feature