mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
refactor: original changes
This commit is contained in:
parent
fa9177180f
commit
f9c0e9853f
83 changed files with 413 additions and 505 deletions
|
|
@ -1,7 +1,6 @@
|
|||
const mongoose = require('mongoose');
|
||||
const { Token, logger } = require('@librechat/data-schemas');
|
||||
const { getRandomValues, hashToken } = require('~/server/utils/crypto');
|
||||
const logger = require('~/config/winston');
|
||||
const db = require('~/lib/db/connectDb');
|
||||
|
||||
/**
|
||||
* @module inviteUser
|
||||
|
|
@ -23,7 +22,7 @@ const createInvite = async (email) => {
|
|||
|
||||
const fakeUserId = new mongoose.Types.ObjectId();
|
||||
|
||||
await db.models.Token.createToken({
|
||||
await Token.createToken({
|
||||
userId: fakeUserId,
|
||||
email,
|
||||
token: hash,
|
||||
|
|
@ -50,7 +49,7 @@ const getInvite = async (encodedToken, email) => {
|
|||
try {
|
||||
const token = decodeURIComponent(encodedToken);
|
||||
const hash = await hashToken(token);
|
||||
const invite = await db.models.Token.findToken({ token: hash, email });
|
||||
const invite = await Token.findToken({ token: hash, email });
|
||||
|
||||
if (!invite) {
|
||||
throw new Error('Invite not found or email does not match');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue