diff --git a/src/apps/users/api/password.py b/src/apps/users/api/password.py index 8d17527d133..febdf77d55e 100644 --- a/src/apps/users/api/password.py +++ b/src/apps/users/api/password.py @@ -1,6 +1,7 @@ import uuid from typing import Annotated +from apps.shared.enums import Language from fastapi import Body, Depends, Query, Request from pydantic import Required from starlette import status @@ -72,8 +73,10 @@ async def password_recovery( async with atomic(session): try: content_source = await get_mindlogger_content_source(request) - content_language = request.headers.get("content-language", "en") - await PasswordRecoveryService(session).send_password_recovery(schema, content_source, content_language) + content_language: Language = request.headers.get("content-language", "en") + await PasswordRecoveryService(session).send_password_recovery( + schema, content_source, language=content_language + ) except UserNotFound: pass # mute error in terms of user enumeration vulnerability diff --git a/src/apps/users/services/core.py b/src/apps/users/services/core.py index 9d30f871a76..d6239f704d0 100644 --- a/src/apps/users/services/core.py +++ b/src/apps/users/services/core.py @@ -34,7 +34,7 @@ async def send_password_recovery( self, schema: PasswordRecoveryRequest, content_source: MindloggerContentSource, - content_language: Language, + language: Language, ) -> PublicUser: user: User = await UsersCRUD(self.session).get_by_email(schema.email) @@ -93,9 +93,13 @@ async def send_password_recovery( message = MessageSchema( recipients=[user.email_encrypted], subject="Password reset", + subject=service.get_localized_string( + key="password_reset_subject", + language=language, + ), body=service.get_localized_html_template( template_name="reset_password", - language=content_language, + language=language, email=user.email_encrypted, expiration_minutes=exp, url=url,