mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +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,8 +1,6 @@
|
|||
const mongoose = require('mongoose');
|
||||
const { webcrypto } = require('node:crypto');
|
||||
const { hashBackupCode, decryptV3, decryptV2 } = require('~/server/utils/crypto');
|
||||
|
||||
const User = require('~/db/models').User;
|
||||
const { updateUser } = require('~/models');
|
||||
|
||||
// Base32 alphabet for TOTP secret encoding.
|
||||
const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
|
@ -174,7 +172,7 @@ const verifyBackupCode = async ({ user, backupCode }) => {
|
|||
: codeObj,
|
||||
);
|
||||
// Update the user record with the marked backup code.
|
||||
await User.updateUser(user._id, { backupCodes: updatedBackupCodes });
|
||||
await updateUser(user._id, { backupCodes: updatedBackupCodes });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue