Skip to content

Commit d9ff3bb

Browse files
committed
Update the reset password template to use the relevant environment frontend URL
1 parent 27a6b07 commit d9ff3bb

File tree

6 files changed

+9
-3
lines changed

6 files changed

+9
-3
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
DEPLOYMENT_TYPE="development" # Deployment type (development, staging, production)
2+
FRONTEND_URL="http://localhost:8081"
23

34
KALEMAT_API_KEY="" # Token for Qur'an and Hadith search
45
ANTHROPIC_API_KEY="" # API key for Claude AI model

.github/workflows/deploy-production.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
env:
4747
DEPLOYMENT_TYPE: production
4848
LOGGING_LEVEL: INFO
49+
FRONTEND_URL: ${{ format('{0}{1}', secrets.SSM_ROOT, 'frontend-url') }}
4950
MONGO_URL: ${{ format('{0}{1}', secrets.SSM_ROOT, 'mongo-url') }}
5051
MONGO_DB_NAME: ${{ format('{0}{1}', secrets.SSM_ROOT, 'mongo-db-name') }}
5152
SECRET_KEY: ${{ format('{0}{1}', secrets.SSM_ROOT, 'secret-key') }}
@@ -89,6 +90,7 @@ jobs:
8990
DEPLOYMENT_TYPE
9091
LOGGING_LEVEL
9192
copy-secret-env-vars: |
93+
FRONTEND_URL
9294
MONGO_URL
9395
MONGO_DB_NAME
9496
SECRET_KEY

.github/workflows/deploy-staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
env:
4747
DEPLOYMENT_TYPE: staging
4848
LOGGING_LEVEL: DEBUG
49+
FRONTEND_URL: ${{ format('{0}{1}', secrets.SSM_ROOT, 'frontend-url') }}
4950
MONGO_URL: ${{ format('{0}{1}', secrets.SSM_ROOT, 'mongo-url') }}
5051
MONGO_DB_NAME: ${{ format('{0}{1}', secrets.SSM_ROOT, 'mongo-db-name') }}
5152
SECRET_KEY: ${{ format('{0}{1}', secrets.SSM_ROOT, 'secret-key') }}
@@ -89,6 +90,7 @@ jobs:
8990
DEPLOYMENT_TYPE
9091
LOGGING_LEVEL
9192
copy-secret-env-vars: |
93+
FRONTEND_URL
9294
MONGO_URL
9395
MONGO_DB_NAME
9496
SECRET_KEY

src/ansari/app/main_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ async def request_password_reset(
789789
# shall we also revoke login and refresh tokens?
790790
tenv = Environment(loader=FileSystemLoader(settings.template_dir))
791791
template = tenv.get_template("password_reset.html")
792-
rendered_template = template.render(reset_token=reset_token)
792+
rendered_template = template.render(reset_token=reset_token, frontend_url=settings.FRONTEND_URL)
793793
message = Mail(
794794
from_email=Email("feedback@ansari.chat"),
795795
to_emails=To(req.email),

src/ansari/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def get_resource_path(filename):
4141
return path
4242

4343
DEPLOYMENT_TYPE: str = Field(default="development")
44+
FRONTEND_URL: str = Field(default="https://ansari.chat")
4445
SENTRY_DSN: HttpUrl | None = None
4546

4647
DATABASE_URL: PostgresDsn = Field(

src/ansari/resources/templates/password_reset.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ <h2>Reset your Ansari Password</h2>
44

55
<p>If you did not request a reset of your Ansari password, you can safely ignore this.</p>
66

7-
<p>Click on <a href="https://ansari.chat/reset-password?token={{reset_token}}">this link</a> to reset your password.</p>
7+
<p>Click on <a href="{{frontend_url}}/reset-password?token={{reset_token}}">this link</a> to reset your password.</p>
88

99
Or paste this link into your browser:
1010

11-
https://ansari.chat/reset-password?token={{reset_token}}
11+
{{frontend_url}}/reset-password?token={{reset_token}}

0 commit comments

Comments
 (0)