mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
fix(models): update user and token operations to use centralized functions
This commit is contained in:
parent
6e278f6932
commit
3831ad8202
10 changed files with 48 additions and 58 deletions
|
|
@ -1,14 +1,11 @@
|
|||
const fs = require('fs');
|
||||
const mongoose = require('mongoose');
|
||||
const LdapStrategy = require('passport-ldapauth');
|
||||
const { SystemRoles } = require('librechat-data-provider');
|
||||
const { logger } = require('@librechat/data-schemas');
|
||||
const { createUser, findUser, updateUser } = require('~/models');
|
||||
const { createUser, findUser, updateUser, countUsers } = require('~/models');
|
||||
const { getBalanceConfig } = require('~/server/services/Config');
|
||||
const { isEnabled } = require('~/server/utils');
|
||||
|
||||
const User = require('~/db/models').User;
|
||||
|
||||
const {
|
||||
LDAP_URL,
|
||||
LDAP_BIND_DN,
|
||||
|
|
@ -117,7 +114,7 @@ const ldapLogin = new LdapStrategy(ldapOptions, async (userinfo, done) => {
|
|||
}
|
||||
|
||||
if (!user) {
|
||||
const isFirstRegisteredUser = (await User.countUsers()) === 0;
|
||||
const isFirstRegisteredUser = (await countUsers()) === 0;
|
||||
user = {
|
||||
provider: 'ldap',
|
||||
ldapId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue