mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-06 09:13:19 +03:00
🐛 Bug Report: Test email sent to wrong address #417
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ethack on GitHub.
Reproduction steps
I logged into my admin account and configured SMTP settings. I hit the "Send Test Email" button.
Here is a screenshot showing the first characters of the email associated with the account I'm authenticated as.

Expected behavior
I expected the test email to be sent to my email address (the one configured on the account I'm logged in as).
Actual Behavior
The test email was sent to a different user's email address. The user is the only other user in Pocket ID and is a regular user (non-admin).
Here is a screenshot of the mail service logs showing the email was sent to the wrong address.

@ethack commented on GitHub:
If I'm understanding this correctly, it looks to be pulling the first user out of the database and sending to their email.
82e475a923/backend/internal/service/email_service.go (L49)The gorm docs state that
Firstorders by primary key.I checked and table has a primary key set to
id. It just so happens that my second user'sidcomes before mine.I suggest specifying the current logged in user in the query.
@stonith404 commented on GitHub:
Thanks, yeah it took the first user. In
v0.24.0it should now send the email to the currently signed in user.