nodebb-plugin-session-guard
v1.0.9
Published
Tek cihaz koruması.
Readme
NodeBB Session Guard (Anti-Sharing Plugin)
This plugin is designed to prevent account sharing on NodeBB forums. It is particularly useful for forums with subscription or premium membership models, ensuring that a single account cannot be shared among multiple people in different locations.
🚀 Features
- Smart Session Management: Automatically terminates the old session when a user logs in from a different computer or location (different IP).
- Mobile Exemption: Mobile phones (iOS/Android) are exempt from this restriction. Users can log in from their phones without affecting their desktop sessions.
- Smart IP Protection: Allows multiple browsers or tabs on the same computer (or same IP address). This prevents users from being logged out when switching browsers or using school/library networks.
- Global Guard: Uses a global middleware to check every request (Page, API, Assets). Unauthorized sessions are terminated instantly.
- NodeBB v4.x Compatible: Fully compatible with NodeBB v4.6+ (works directly with the database, bypassing deprecated functions).
- Admin Exemption: Administrators are exempt from these restrictions.
🛠️ How It Works (Logic Table)
The system behaves differently based on the device type and IP address:
| Scenario | Device Type | IP Address | Result | | :--- | :--- | :--- | :--- | | Logged in from Home PC | Desktop | 192.168.1.5 | ✅ Session Active. | | Then logged in from Phone | Mobile | (Any) | ✅ Session Active. (Both PC and Phone remain active). | | Opened a different browser on same PC | Desktop | 192.168.1.5 | ✅ Session Active. (Same IP = Allowed). | | Friend logged in from their house | Desktop | Different IP | ❌ Old Session KILLED. (Your home session is terminated). | | Logged in from Tablet | Tablet/iPad | (Any) | ⚠️ Tablets are treated as Desktops. If IP is different, old PC session is killed. |
📦 Installation
If this plugin is not published on npm, you can install it manually:
Upload the plugin folder to your
node_modulesdirectory:/path/to/nodebb/node_modules/nodebb-plugin-session-guardActivate the plugin:
./nodebb activate nodebb-plugin-session-guardRebuild and restart NodeBB:
./nodebb build ./nodebb restart
⚙️ Requirements
- NodeBB: v3.0.0 or higher (Tested on v4.6.0+)
- Database: Redis or MongoDB (Compatible with both)
📝 License
MIT
