mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
fix(auth): replace mongoose model references with new function imports
- Updated AuthController, checkBan middleware, localStrategy, and openidStrategy to use new function imports for user operations. - Removed unused mongoose imports to streamline the codebase. - Enhanced consistency across user-related operations by utilizing the centralized methods for user management.
This commit is contained in:
parent
90ac2b51cd
commit
6e278f6932
5 changed files with 12 additions and 241 deletions
|
|
@ -1,9 +1,8 @@
|
|||
const mongoose = require('mongoose');
|
||||
const { logger } = require('@librechat/data-schemas');
|
||||
const { errorsToString } = require('librechat-data-provider');
|
||||
const { Strategy: PassportLocalStrategy } = require('passport-local');
|
||||
const { isEnabled, checkEmailConfig } = require('~/server/utils');
|
||||
const { comparePassword } = require('~/models');
|
||||
const { findUser, comparePassword } = require('~/models');
|
||||
const { loginSchema } = require('./validators');
|
||||
|
||||
const User = require('~/db/models').User;
|
||||
|
|
@ -25,7 +24,7 @@ async function passportLogin(req, email, password, done) {
|
|||
return done(null, false, { message: validationError });
|
||||
}
|
||||
|
||||
const user = await User.findUser({ email: email.trim() });
|
||||
const user = await findUser({ email: email.trim() });
|
||||
if (!user) {
|
||||
logError('Passport Local Strategy - User Not Found', { email });
|
||||
logger.error(`[Login] [Login failed] [Username: ${email}] [Request-IP: ${req.ip}]`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue