mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
- Added `LoginAttempt` Mongoose schema to store login history - Integrated login attempt recording into login flow (success/failure) - Created `rateLimitByAccount` middleware to block login if 10 failed attempts in 10 minutes
15 lines
471 B
TypeScript
15 lines
471 B
TypeScript
import mongoose from 'mongoose'
|
|
|
|
export { User, IUser } from './user.js'
|
|
export { Session, ISession } from './session.js'
|
|
export { Command, ICommand } from './command.js'
|
|
export { UserProfile, IUserProfile, IProgress } from './userProfile.js'
|
|
export { ILoginAttempt, LoginAttempt } from './loginAttempt.js'
|
|
|
|
export async function connectDB(uri: string) {
|
|
const db = await mongoose.connect(uri)
|
|
return db.connection.getClient()
|
|
}
|
|
|
|
console.log('Loaded models package')
|