mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30: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>}
|
||||
*/
|
||||
const sendVerificationEmail = async (user) => {
|
||||
const appConfig = await getAppConfig();
|
||||
const emailVerificationExpiry = appConfig?.registration?.emailVerificationExpiry || 900;
|
||||
|
||||
const [verifyToken, hash] = createTokenHash();
|
||||
|
||||
const verificationLink = `${
|
||||
|
|
@ -103,7 +106,7 @@ const sendVerificationEmail = async (user) => {
|
|||
email: user.email,
|
||||
token: hash,
|
||||
createdAt: Date.now(),
|
||||
expiresIn: 900,
|
||||
expiresIn: emailVerificationExpiry,
|
||||
});
|
||||
|
||||
logger.info(`[sendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
||||
|
|
@ -486,6 +489,9 @@ const setOpenIDAuthTokens = (tokenset, res, userId, existingRefreshToken) => {
|
|||
const resendVerificationEmail = async (req) => {
|
||||
try {
|
||||
const { email } = req.body;
|
||||
const appConfig = await getAppConfig();
|
||||
const emailVerificationExpiry = appConfig?.registration?.emailVerificationExpiry || 900;
|
||||
|
||||
await deleteTokens({ email });
|
||||
const user = await findUser({ email }, 'email _id name');
|
||||
|
||||
|
|
@ -517,7 +523,7 @@ const resendVerificationEmail = async (req) => {
|
|||
email: user.email,
|
||||
token: hash,
|
||||
createdAt: Date.now(),
|
||||
expiresIn: 900,
|
||||
expiresIn: emailVerificationExpiry,
|
||||
});
|
||||
|
||||
logger.info(`[resendVerificationEmail] Verification link issued. [Email: ${user.email}]`);
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ registration:
|
|||
socialLogins: ['github', 'google', 'discord', 'openid', 'facebook', 'apple', 'saml']
|
||||
# allowedDomains:
|
||||
# - "gmail.com"
|
||||
# emailVerificationExpiry: 900 # Email verification link expiry time in seconds (default: 900 = 15 minutes)
|
||||
|
||||
# Example Balance settings
|
||||
# balance:
|
||||
|
|
|
|||
|
|
@ -862,8 +862,9 @@ export const configSchema = z.object({
|
|||
.object({
|
||||
socialLogins: 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(),
|
||||
transactions: transactionsSchema.optional(),
|
||||
speech: z
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue