Skip to content

fix: generate identity verification URL only if ACCOUNT_MICROFRONTEND_URL is available - #36898

Merged
kdmccormick merged 2 commits into
openedx:masterfrom
mitodl:arslan/7549-fix-identity-url
Jun 12, 2025
Merged

fix: generate identity verification URL only if ACCOUNT_MICROFRONTEND_URL is available#36898
kdmccormick merged 2 commits into
openedx:masterfrom
mitodl:arslan/7549-fix-identity-url

Conversation

@arslanashraf7

@arslanashraf7 arslanashraf7 commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

Related Tickets

https://github.com/mitodl/hq/issues/7549

Description

The api/courseware/course fails for all the verified enrollments if you are not using Account MFE, which means that you probably won't set ACCOUNT_MICROFRONTEND_URL in your settings/configurations. So this PR adds a check safely try to do rstrip.

Useful information to include:

The api/courseware/course is currently broken for enrollments in verified mode if you are not using Account MFE. API current edx-platform master

Impacts: All roles

Supporting information

This issue was a side effect of a recent change #36870

Testing instructions

  • Get yourself enrolled in a verified mode in any course. (This means you will need to create verified mode in the course modes and have a verified enrollment)
  • Make sure that you set ACCOUNT_MICROFRONTEND_URL = None in your settings
  • Load any course in learning MFE, and it should load fine and not throw any errors.

Deadline

Probably soon because this breaks verified enrollments for deployments not using accounts MFE.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 12, 2025
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @arslanashraf7!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jun 12, 2025
@arslanashraf7
arslanashraf7 force-pushed the arslan/7549-fix-identity-url branch 4 times, most recently from 9af3e76 to 3ea742f Compare June 12, 2025 14:09

@asadali145 asadali145 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@asadali145 asadali145 moved this from Needs Triage to Ready for Review in Contributions Jun 12, 2025
@arslanashraf7

Copy link
Copy Markdown
Contributor Author

Hi @kdmccormick. Sorry to tag you directly, but is it possible for you to review this PR? It fixes an issue with #36870 that you reviewed recently.

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Broader question, do these functions even make sense ifaccount_base_url == ""? In those cases, do we really want to send an email with reverify_url == "/id-verification"? Won't that be an invalid link from the perspective of the recipient?


site = Site.objects.get_current()
account_base_url = settings.ACCOUNT_MICROFRONTEND_URL.rstrip('/')
account_base_url = (getattr(settings, "ACCOUNT_MICROFRONTEND_URL", "") or "").rstrip('/')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
account_base_url = (getattr(settings, "ACCOUNT_MICROFRONTEND_URL", "") or "").rstrip('/')
account_base_url = (settings.ACCOUNT_MICROFRONTEND_URL or "").rstrip('/')

getattr is mistake-prone and should only ever be used if absolutely necessary. In all these occurrences, setting.ACCOUNT_MICROFRONTEND_URL is always defined (even if only as None), so you can simply use or in order to fall back to the empty string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 8cb6918

@arslanashraf7

Copy link
Copy Markdown
Contributor Author

Broader question, do these functions even make sense ifaccount_base_url == ""? In those cases, do we really want to send an email with reverify_url == "/id-verification"? Won't that be an invalid link from the perspective of the recipient?

@kdmccormick I agree. I thought about that too, but it felt like a product decision to me, and eventually, this might be something we'll have to think on a larger scale for all the places, and not just email, where we are generating links based on the Account MFE URL. This was a reason I kept that out of the scope of this PR. Let me know if you think otherwise.

@arslanashraf7
arslanashraf7 force-pushed the arslan/7549-fix-identity-url branch 2 times, most recently from 317b7d1 to 8cb6918 Compare June 12, 2025 15:29
@arslanashraf7
arslanashraf7 force-pushed the arslan/7549-fix-identity-url branch from 8cb6918 to f3faec2 Compare June 12, 2025 15:46

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

arslanashraf7 added a commit to mitodl/edx-platform that referenced this pull request Jun 17, 2025
…penedx#36898)

The api/courseware/course fails for all the verified enrollments if you
are not using Account MFE, which means that you probably won't set
ACCOUNT_MICROFRONTEND_URL in your settings/configurations.
So this PR adds a check safely try to do rstrip.

Fixes a bug in openedx#36870
@arslanashraf7

Copy link
Copy Markdown
Contributor Author

@kdmccormick, I noticed that the #36870 was backported to Teak via #36880.

So, I have created #36924 to backport this fix to Teak as well.

@arslanashraf7
arslanashraf7 deleted the arslan/7549-fix-identity-url branch June 17, 2025 11:51
marlonkeating pushed a commit that referenced this pull request Jul 15, 2025
…36898)

The api/courseware/course fails for all the verified enrollments if you
are not using Account MFE, which means that you probably won't set
ACCOUNT_MICROFRONTEND_URL in your settings/configurations.
So this PR adds a check safely try to do rstrip.

Fixes a bug in #36870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants