Skip to content

Commit c62a93d

Browse files
Change user email
1 parent 57641b1 commit c62a93d

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

app.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -828,17 +828,12 @@ def put(self):
828828
return {"error": "No JSON data provided"}, 400
829829

830830
user_info = extract_user_info(request.user)
831-
current_user_id = user_info.get("user_id")
832-
redirect_uri = data.get("redirect_uri")
831+
redirect_uri = settings.FRONTEND_URL
833832
new_email = data.get("new_email")
834833

835-
if not redirect_uri:
836-
return {"error": "redirect_uri is required for confirmation link"}, 400
837834
if not new_email:
838835
return {"error": "new_email is required for confirmation link"}, 400
839-
840836
# Check if user is trying to edit their own profile
841-
print(user_info)
842837
return invite_email_change(user_info, redirect_uri, new_email)
843838
except Exception as e:
844839
logger.exception(f"Changing user email failed: {str(e)}")

email_templates/change_email.mjml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Click the button below to confirm this change. This link is valid for 24 hours.
7373
<mj-section padding="0 0 16px 0">
7474
<mj-column>
7575
<mj-text align="center">
76-
<a href="https://agari.example/accept-invite?token={{TOKEN}}" class="agari-btn">
76+
<a href="{{ accept_link }}" class="agari-btn">
7777
Confirm Email Change
7878
</a>
7979
</mj-text>

helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ def invite_email_change(user, redirect_uri, new_email):
309309

310310
result, status_code = sendgrid_email(to_email, to_name, subject, html_content)
311311

312-
user_id = "af52b5d2-29bc-4b5d-ac65-2c1bc5583368" # user["user_id"]
312+
user_id = user["user_id"]
313313
if status_code in [200, 201, 202, 204]:
314314
# assign temp invite attributes to user
315315
keycloak_auth.add_attribute_value(user_id, "invite_token", inv_token)

settings.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
KEYCLOAK_CLIENT_ID = os.getenv('KEYCLOAK_CLIENT_ID', 'dms')
1818
KEYCLOAK_CLIENT_SECRET = os.getenv('KEYCLOAK_CLIENT_SECRET', 'VDyLEjGR3xDQvoQlrHq5AB6OwbW0Refc')
1919

20-
# Overture (SONG and SCORE) Configuration
21-
OVERTURE_SONG = os.getenv('OVERTURE_SONG', 'http://song.local')
22-
OVERTURE_SCORE = os.getenv('OVERTURE_SCORE', 'http://score.local')
23-
2420
# MinIO Configuration
2521
MINIO_ENDPOINT = os.getenv('MINIO_ENDPOINT', 'localhost:9000')
2622
MINIO_ACCESS_KEY = os.getenv('MINIO_ACCESS_KEY', 'admin')
@@ -45,3 +41,5 @@
4541

4642
# Application Configuration
4743
PORT = int(os.getenv('PORT', 8000))
44+
45+
FRONTEND_URL = os.getenv('FRONTEND_URL', 'agari.local')

0 commit comments

Comments
 (0)