mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
Merge a36902866a into f9060fa25f
This commit is contained in:
commit
c06781f102
3 changed files with 11 additions and 3 deletions
|
|
@ -81,6 +81,9 @@ const createTokenHash = () => {
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
const sendVerificationEmail = async (user) => {
|
const sendVerificationEmail = async (user) => {
|
||||||
|
const appConfig = await getAppConfig();
|
||||||
|
const emailVerificationExpiry = appConfig?.registration?.emailVerificationExpiry || 900;
|
||||||
|
|
||||||
const [verifyToken, hash] = createTokenHash();
|
const [verifyToken, hash] = createTokenHash();
|
||||||
|
|
||||||
const verificationLink = `${
|
const verificationLink = `${
|
||||||
|
|
@ -103,7 +106,7 @@ const sendVerificationEmail = async (user) => {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
token: hash,
|
token: hash,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
expiresIn: 900,
|
expiresIn: emailVerificationExpiry,
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`[sendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
logger.info(`[sendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
||||||
|
|
@ -486,6 +489,9 @@ const setOpenIDAuthTokens = (tokenset, res, userId, existingRefreshToken) => {
|
||||||
const resendVerificationEmail = async (req) => {
|
const resendVerificationEmail = async (req) => {
|
||||||
try {
|
try {
|
||||||
const { email } = req.body;
|
const { email } = req.body;
|
||||||
|
const appConfig = await getAppConfig();
|
||||||
|
const emailVerificationExpiry = appConfig?.registration?.emailVerificationExpiry || 900;
|
||||||
|
|
||||||
await deleteTokens({ email });
|
await deleteTokens({ email });
|
||||||
const user = await findUser({ email }, 'email _id name');
|
const user = await findUser({ email }, 'email _id name');
|
||||||
|
|
||||||
|
|
@ -517,7 +523,7 @@ const resendVerificationEmail = async (req) => {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
token: hash,
|
token: hash,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
expiresIn: 900,
|
expiresIn: emailVerificationExpiry,
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info(`[resendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
logger.info(`[resendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,7 @@ registration:
|
||||||
socialLogins: ['github', 'google', 'discord', 'openid', 'facebook', 'apple', 'saml']
|
socialLogins: ['github', 'google', 'discord', 'openid', 'facebook', 'apple', 'saml']
|
||||||
# allowedDomains:
|
# allowedDomains:
|
||||||
# - "gmail.com"
|
# - "gmail.com"
|
||||||
|
# emailVerificationExpiry: 900 # Email verification link expiry time in seconds (default: 900 = 15 minutes)
|
||||||
|
|
||||||
# Example Balance settings
|
# Example Balance settings
|
||||||
# balance:
|
# balance:
|
||||||
|
|
|
||||||
|
|
@ -862,8 +862,9 @@ export const configSchema = z.object({
|
||||||
.object({
|
.object({
|
||||||
socialLogins: z.array(z.string()).optional(),
|
socialLogins: z.array(z.string()).optional(),
|
||||||
allowedDomains: z.array(z.string()).optional(),
|
allowedDomains: z.array(z.string()).optional(),
|
||||||
|
emailVerificationExpiry: z.number().default(900),
|
||||||
})
|
})
|
||||||
.default({ socialLogins: defaultSocialLogins }),
|
.default({ socialLogins: defaultSocialLogins, emailVerificationExpiry: 900 }),
|
||||||
balance: balanceSchema.optional(),
|
balance: balanceSchema.optional(),
|
||||||
transactions: transactionsSchema.optional(),
|
transactions: transactionsSchema.optional(),
|
||||||
speech: z
|
speech: z
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue