Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Email verification #5465

Closed
1 task done
rnehrboss opened this issue Jan 25, 2025 · 6 comments · Fixed by #5485
Closed
1 task done

[Bug]: Email verification #5465

rnehrboss opened this issue Jan 25, 2025 · 6 comments · Fixed by #5485
Labels
bug Something isn't working

Comments

@rnehrboss
Copy link

What happened?

When setting up new account, and clicking on the email verification, it seems that both Safari and Chrome, on IOS bring up a page that says "Email Verification Failed"

However, it looks from the user database that LibreChat is setting the emailVerified in the User collection record to "true". It confuses users because they think it didn't work.

Steps to Reproduce

Sign up new account.

Click verify email.

What browsers are you seeing the problem on?

No response

Relevant log output

Here is the debug log:
---------
2025-01-25T19:40:33.516Z info: [sendVerificationEmail] Verification link issued. [Email: [email protected]]
2025-01-25T19:41:40.468Z info: [verifyEmail] Email verification successful. [Email: [email protected]]
2025-01-25T19:45:03.933Z warn: [verifyEmail] [No email verification data found] [Email: [email protected]]

2025-01-25T19:46:07.118Z info: [sendVerificationEmail] Verification link issued. [Email: [email protected]]
2025-01-25T19:47:24.947Z info: [verifyEmail] Email verification successful. [Email: [email protected]]
2025-01-25T19:47:24.990Z warn: [verifyEmail] [No email verification data found] [Email: [email protected]]
-------------
If however I click the email verification link from chrome on windows, I get a good page that says "Email Verification Successful"

2025-01-25T19:19:35.846Z info: [sendVerificationEmail] Verification link issued. [Email: [email protected]]
2025-01-25T19:19:48.914Z info: [verifyEmail] Email verification successful. [Email: [email protected]]

2025-01-25T19:26:25.921Z info: [sendVerificationEmail] Verification link issued. [Email: [email protected]]
2025-01-25T19:27:22.559Z info: [verifyEmail] Email verification successful. [Email: [email protected]]

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@rnehrboss rnehrboss added the bug Something isn't working label Jan 25, 2025
@berry-13 berry-13 assigned berry-13 and unassigned berry-13 Jan 26, 2025
@berry-13
Copy link
Collaborator

@rnehrboss This happens because it "preloads" the link, which automatically verifies the email. I'll fix this by adding a confirmation step with a button

@rnehrboss
Copy link
Author

Thanks @berry-13 . I appreciate it. I'm suprised that more people havent mentioned it.

@berry-13
Copy link
Collaborator

Thanks @berry-13 . I appreciate it. I'm suprised that more people havent mentioned it.

I was the one who worked on this, and during testing with Gmail and Chrome on an iPad, I didn't encounter any issues. However, I haven't tested it since, as I don't frequently use Apple products. It's possible that this issue affected only iOS/iPadOS users with Safari and Chrome, or those using Outlook emails. I've now thought an even better solution, which I'll explain in detail in the PR

@rnehrboss
Copy link
Author

@berry-13 Wow.. quick work. Thanks.
If I'm running docker and overwrite the two files you changed, do I need to do a "docker compose up --build", and is that sufficient? I have some of my own changes.

Thanks again?

@rnehrboss
Copy link
Author

uh oh.. i think I blew it. @berry-13

I put your changed code over the AuthService.js and VerifyEmail.tsx, rebuilt, but now get:

LibreChat | Node.js v20.18.2
LibreChat exited with code 1
LibreChat |
LibreChat | > [email protected] backend
LibreChat | > cross-env NODE_ENV=production node api/server/index.js
LibreChat |
LibreChat | 2025-01-27 02:01:23 info: [Optional] Redis not initialized. Note: Redis support is experimental.
LibreChat | node:internal/modules/cjs/loader:1228
LibreChat | throw err;
LibreChat | ^
LibreChat |
LibreChat | Error: Cannot find module '/app/api/server/services/domains'
LibreChat | Require stack:
LibreChat | - /app/api/server/services/AuthService.js
LibreChat | - /app/api/server/middleware/checkDomainAllowed.js
LibreChat | - /app/api/server/middleware/index.js
LibreChat | - /app/api/server/routes/assistants/index.js
LibreChat | - /app/api/server/routes/index.js
LibreChat | - /app/api/server/index.js
LibreChat | at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
LibreChat | at Module._resolveFilename (/app/node_modules/module-alias/index.js:49:29)
LibreChat | at Module._load (node:internal/modules/cjs/loader:1051:27)
LibreChat | at Module.require (node:internal/modules/cjs/loader:1311:19)
LibreChat | at require (node:internal/modules/helpers:179:18)
LibreChat | at Object. (/app/api/server/services/AuthService.js:23:34)
LibreChat | at Module._compile (node:internal/modules/cjs/loader:1469:14)
LibreChat | at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
LibreChat | at Module.load (node:internal/modules/cjs/loader:1288:32)
LibreChat | at Module._load (node:internal/modules/cjs/loader:1104:12) {
LibreChat | code: 'MODULE_NOT_FOUND',
LibreChat | requireStack: [
LibreChat | '/app/api/server/services/AuthService.js',
LibreChat | '/app/api/server/middleware/checkDomainAllowed.js',
LibreChat | '/app/api/server/middleware/index.js',
LibreChat | '/app/api/server/routes/assistants/index.js',
LibreChat | '/app/api/server/routes/index.js',
LibreChat | '/app/api/server/index.js'
LibreChat | ]
LibreChat | }
LibreChat |

Any thoughts?

@berry-13
Copy link
Collaborator

berry-13 commented Jan 27, 2025

@rnehrboss No need to build the image; just pull the latest image, and the fix will be in it. Make sure to first pull the latest image, then recreate the Docker container so it uses the new image. Afterward, delete the old image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants