@@ -45,15 +45,14 @@ <h1 class="title">Module <code>supertokens_python.recipe.emailpassword.emaildeli
4545from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Union
4646
4747from httpx import AsyncClient
48+
4849from supertokens_python.ingredients.emaildelivery.types import EmailDeliveryInterface
4950from supertokens_python.logger import log_debug_message
5051from supertokens_python.recipe.emailpassword.interfaces import (
5152 EmailTemplateVars,
5253 RecipeInterface,
5354)
54- from supertokens_python.recipe.emailpassword.types import (
55- User,
56- )
55+ from supertokens_python.recipe.emailpassword.types import User
5756from supertokens_python.supertokens import AppInfo
5857from supertokens_python.utils import handle_httpx_client_exceptions
5958
@@ -124,6 +123,10 @@ <h1 class="title">Module <code>supertokens_python.recipe.emailpassword.emaildeli
124123 if user is None:
125124 raise Exception("Should never come here")
126125
126+ # we add this here cause the user may have overridden the sendEmail function
127+ # to change the input email and if we don't do this, the input email
128+ # will get reset by the getUserById call above.
129+ user.email = template_vars.user.email
127130 try:
128131 await self.reset_password_feature_send_email_func(
129132 user, template_vars.password_reset_link, user_context
@@ -225,6 +228,10 @@ <h2 class="section-title" id="header-classes">Classes</h2>
225228 if user is None:
226229 raise Exception("Should never come here")
227230
231+ # we add this here cause the user may have overridden the sendEmail function
232+ # to change the input email and if we don't do this, the input email
233+ # will get reset by the getUserById call above.
234+ user.email = template_vars.user.email
228235 try:
229236 await self.reset_password_feature_send_email_func(
230237 user, template_vars.password_reset_link, user_context
@@ -265,6 +272,10 @@ <h3>Methods</h3>
265272 if user is None:
266273 raise Exception("Should never come here")
267274
275+ # we add this here cause the user may have overridden the sendEmail function
276+ # to change the input email and if we don't do this, the input email
277+ # will get reset by the getUserById call above.
278+ user.email = template_vars.user.email
268279 try:
269280 await self.reset_password_feature_send_email_func(
270281 user, template_vars.password_reset_link, user_context
0 commit comments