mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-30 15:18:50 +01:00
👤 fix: Create User with timestamps (#3070)
* 👤 fix: Create User with timestamps
* chore: fix lint script to ignore venv
* chore: linting
This commit is contained in:
parent
bcaa7d5d29
commit
04502e9525
4 changed files with 11 additions and 12 deletions
|
|
@ -62,7 +62,7 @@ const updateUser = async function (userId, updateData) {
|
|||
const createUser = async (data, disableTTL = true) => {
|
||||
const userData = {
|
||||
...data,
|
||||
expiresAt: new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds
|
||||
expiresAt: disableTTL ? null : new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds
|
||||
};
|
||||
|
||||
if (disableTTL) {
|
||||
|
|
@ -70,8 +70,8 @@ const createUser = async (data, disableTTL = true) => {
|
|||
}
|
||||
|
||||
try {
|
||||
const result = await User.collection.insertOne(userData);
|
||||
return result.insertedId;
|
||||
const user = await User.create(userData);
|
||||
return user._id;
|
||||
} catch (error) {
|
||||
if (error.code === 11000) {
|
||||
// Duplicate key error code
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ function convertToUsername(input, defaultValue = '') {
|
|||
async function setupOpenId() {
|
||||
try {
|
||||
if (process.env.PROXY) {
|
||||
const proxyAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||
custom.setHttpOptionsDefaults({
|
||||
agent: proxyAgent
|
||||
});
|
||||
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
|
||||
const proxyAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||
custom.setHttpOptionsDefaults({
|
||||
agent: proxyAgent,
|
||||
});
|
||||
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
|
||||
}
|
||||
const issuer = await Issuer.discover(process.env.OPENID_ISSUER);
|
||||
const client = new issuer.Client({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue