webinterface/server/models/User.js

39 lines
849 B
JavaScript
Raw Permalink Normal View History

2024-10-29 21:09:13 +01:00
const mongoose = require('mongoose');
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true,
unique: true,
trim: true
},
email: {
type: String,
required: true,
unique: true,
trim: true
},
password: {
type: String, // Wird davor zu einem Hash umgewandelt
required: true
},
createdAt: {
type: Date,
default: Date.now
},
isAdmin: {
type: Boolean,
default: false // Standardwert ist false
},
failedLoginAttempts: { // Track failed login attempts
type: Number,
default: 0
},
lastFailedLogin: { // Track the last failed login attempt time
type: Date,
default: null
},
2024-10-29 21:09:13 +01:00
});
module.exports = mongoose.model('User', userSchema);