W
Wasp3w ago
jason

How can I log the 'request-password-reset' email in the server console while using the Dummy sender?

Hi all, I'm working on a new Wasp project based on the OpenSaaS template, attempting to implement multi-tenancy. Part of this includes inviting new users, which if the email isn't associated with an account already, it creates an account for that email and sends an email with a link to the request-password-reset URL, instructing the user to change their password then log in. My question is, when a user account is created, the Dummy email sender outputs the email to the server console so that I can just click the link to activate it. However, when I submit the request-password-reset action, I don't see any way to see that resulting value. I assume it's some URL with a key value. How can I make that known? I can easily create new user accounts, but I have no way of testing the entire system until I can request password resets in development.
3 Replies
kapa.ai
kapa.ai3w ago
Hi @jason. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To answer your question about logging the 'request-password-reset' email in the server console while using the Dummy sender in Wasp, I can provide some relevant information based on the knowledge sources. When using the Dummy email provider in Wasp, emails are indeed logged to the console instead of being sent. This is designed to speed up development and testing. According to the Wasp documentation on email providers: "To speed up development, Wasp offers a Dummy email sender that console.logs the emails in the console. Since it doesn't send emails for real, it doesn't require any setup." To set up the Dummy provider, you need to add the following to your main.wasp file:
app Example {
...
emailSender: {
provider: Dummy,
}
}
app Example {
...
emailSender: {
provider: Dummy,
}
}
Regarding the password reset flow, Wasp provides built-in functionality for this. When a user requests a password reset, they should receive an email with a link to reset their password. This email content is customizable. However, I couldn't find specific information in the provided knowledge sources about how to explicitly log or view the password reset link when using the Dummy provider. The documentation doesn't mention a direct way to access or view this link in the development environment. Given this limitation, here are a few suggestions that might help: 1. Check your server console logs carefully. The Dummy provider should log all email content, including password reset emails, to the console. Look for any logs that contain password reset links. 2. You might be able to customize the email content for password resets to make the link more visible in the logs. You can do this by modifying the getPasswordResetEmailContent function, as shown in the Wasp documentation on password reset:
export const getPasswordResetEmailContent: GetPasswordResetEmailContentFn = ({
passwordResetLink,
}) => ({
subject: 'Password reset',
text: `Click the link below to reset your password: ${passwordResetLink}`,
html: `
<p>Click the link below to reset your password</p>
<a href="${passwordResetLink}">Reset password</a>
`,
})
export const getPasswordResetEmailContent: GetPasswordResetEmailContentFn = ({
passwordResetLink,
}) => ({
subject: 'Password reset',
text: `Click the link below to reset your password: ${passwordResetLink}`,
html: `
<p>Click the link below to reset your password</p>
<a href="${passwordResetLink}">Reset password</a>
`,
})
3. If you're still unable to see the password reset link, you might need to add additional logging in your custom implementation of the password reset flow. If these suggestions don't solve your issue, it might be worth reaching out to the Wasp community or developers for more specific guidance, as the current documentation doesn't provide a clear solution for your particular use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @jason, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
jason
jasonOP3w ago
Does a lack of a Dummy email output imply that it's failing somewhere? It's returning 200 in the server console, but this is ALL that I see upon submission: [ Server ] POST /auth/email/request-password-reset 200 1056.386 ms - 16 Nevermind. I've made a mistake via a fundamental misunderstanding of Wasp auth. For some reason users created via my invite system have null values in their "auth" column in the prisma 'User' model. I suspect this is why the request-password-reset isn't sending anything. Success! Got it working properly :wizardboi: sorry for opening a new thread before fully understanding the issue! If someone wants to delete this then please go ahead.
Vinny (@Wasp)
Vinny (@Wasp)3w ago
No worries. Glad you got it working! What was the fix?

Did you find this page helpful?