mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🔐 refactor: Unverified User Verification Logic (#4482)
This commit is contained in:
parent
4d4a6b53f1
commit
f121439960
2 changed files with 9 additions and 3 deletions
|
|
@ -48,7 +48,12 @@ async function passportLogin(req, email, password, done) {
|
|||
user.emailVerified = true;
|
||||
}
|
||||
|
||||
if (!user.emailVerified && !isEnabled(process.env.ALLOW_UNVERIFIED_EMAIL_LOGIN)) {
|
||||
const unverifiedAllowed = isEnabled(process.env.ALLOW_UNVERIFIED_EMAIL_LOGIN);
|
||||
if (user.expiresAt && unverifiedAllowed) {
|
||||
await updateUser(user._id, {});
|
||||
}
|
||||
|
||||
if (!user.emailVerified && !unverifiedAllowed) {
|
||||
logError('Passport Local Strategy - Email not verified', { email });
|
||||
logger.error(`[Login] [Login failed] [Username: ${email}] [Request-IP: ${req.ip}]`);
|
||||
return done(null, user, { message: 'Email not verified.' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue