@dax-crafta/auth
Version:
A powerful, flexible, and secure authentication plugin for the Crafta framework. Supports JWT, social login, 2FA, RBAC, audit logging, and enterprise-grade security features.
28 lines (26 loc) • 666 B
JavaScript
const mongoose = require('mongoose');
const auditLogSchema = new mongoose.Schema({
userId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
action: {
type: String,
required: true,
enum: ['login', 'logout', 'password_change', 'profile_update', 'role_change', '2fa_enabled', '2fa_disabled']
},
ipAddress: String,
userAgent: String,
details: mongoose.Schema.Types.Mixed,
status: {
type: String,
enum: ['success', 'failure'],
required: true
},
timestamp: {
type: Date,
default: Date.now
}
});
module.exports = mongoose.model('AuditLog', auditLogSchema);