Skip to content

Conversation

@samuelallan72
Copy link
Contributor

@samuelallan72 samuelallan72 commented Sep 11, 2019

This PR enables setting/changing a user's password from the django admin, gated
behind a django setting FEATURES flag.

Using a django settings option because this affects entries to urls.py, which require a server restart to take effect. Using a waffle switch is misleading, because toggling it without restarting the server afterwards would leave the platform in an invalid state.

This behaviour was disabled across https://github.com/edx/edx-platform/pull/18970 and https://github.com/edx/edx-platform/pull/18972.

We want to re-enable it because our clients use this feature.

JIRA tickets: OSPR-3840

Dependencies: None

Sandbox URL:

Merge deadline: None

Testing instructions:

  1. login to the admin on the lms as a superuser
  2. navigate the admin change page for a user (eg /admin/auth/user/1/change/)
  3. verify that there is no link to a password change form in the description
    for the password field. (You should not see " but you can change the
    password using this form.")
  4. change the current url from .../change/ to .../password/ (eg.
    /admin/auth/user/1/password/)
  5. verify that a 404 page is displayed
  6. repeat steps 2 - 5 on the cms
  7. add/change the FEATURES: ENABLE_CHANGE_USER_PASSWORD_ADMIN flag to true in the lms config.
  8. restart the cms and lms apps (reboot the server or run
    /edx/bin/supervisorctl restart lms: cms: from a shell).
  9. log in to the admin on the lms as a superuser
  10. navigate the admin change page for a user (eg /admin/auth/user/1/change/)
  11. verify that a link to a password change form ("but you can change the
    password using this form") is visible.
  12. click the form link and verify that the page loads correctly and the user
    password can be changed
  13. repeat the previous 4 steps from the cms admin.

Author notes and concerns:

Reviewers

Settings

EDXAPP_FEATURES:
  ENABLE_CHANGE_USER_PASSWORD_ADMIN: false

@samuelallan72 samuelallan72 requested a review from a team September 11, 2019 01:14
@openedx-webhooks
Copy link

Thanks for the pull request, @swalladge! I've created OSPR-3840 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams.

Feel free to add as much of the following information to the ticket:

  • supporting documentation
  • edx-code email threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here.

@openedx-webhooks openedx-webhooks added needs triage open-source-contribution PR author is not from Axim or 2U labels Sep 11, 2019
@natabene
Copy link
Contributor

@swalladge Thank you for your contribution. Please let me know once all tests are green.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs triage labels Sep 11, 2019
@samuelallan72
Copy link
Contributor Author

@natabene We're not sure what's happening with the tests; they appear to be failing for reasons unrelated to the changes in this PR.

We also have a question about the implementation for this that we'd appreciate an early look at: we initially implemented this using waffle switches, but then switched to a django setting in edx@c685617 (the rationale being that a django setting would be more appropriate because changes to this toggle require restarting the server or a redeploy). Which method would edX prefer?

Thanks.

@samuelallan72
Copy link
Contributor Author

samuelallan72 commented Sep 12, 2019

It seems that tests are failing on installing configparser==4.0.1, which doesn't exist as a pypi release yet (latest at time of writing is 3.8.1 https://pypi.org/project/configparser/#history ). Strangely, this change was introduced in https://github.com/edx/edx-platform/pull/21609, and the tests run fine. ¯\_(ツ)_/¯

EDIT: configparser 4.0.x was pulled from pypi: jaraco/configparser#45 (comment)

EDIT2: opened https://github.com/edx/edx-platform/pull/21634 to fix this until upstream publishes a new release

EDIT3: a fix has been merged to master. will rebase this branch as soon as i get a chance. (done)

@natabene natabene requested a review from marcotuts September 12, 2019 14:19
@natabene
Copy link
Contributor

@marcotuts Can you give this an early look please?

@openedx-webhooks openedx-webhooks added product review PR requires product review before merging and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels Sep 12, 2019
@nedbat
Copy link
Contributor

nedbat commented Sep 12, 2019

If/when this is merged, also merge the documentation change: https://github.com/edx/edx-documentation/pull/1842

@samuelallan72 samuelallan72 force-pushed the samuel/gate-change-password branch from c685617 to 3860741 Compare September 12, 2019 23:42
@clemente
Copy link
Contributor

👍

  • I tested this: test instructions. I didn't see the link until I enabled the flag. The form to change the password worked
  • I read through the code, it's clean
  • I checked for accessibility issues: none, and it's better like this
  • Includes documentation: yes, here

There's still the question of whether we want a feature flag or a Waffle switch, but I'll leave this to edX. Waffle switches are to be applied dynamically, without restart, but this new feature modifies URLs and requires a restart, so therefore a FEATURE flag seems better.

@swalladge could you check the sandbox and then ping Ned when it's ready?

@samuelallan72
Copy link
Contributor Author

@natabene CC @nedbat the sandbox is provisioned and this is ready for edX review. 🙂

@natabene
Copy link
Contributor

@marcotuts This is awaiting your review.

@samuelallan72
Copy link
Contributor Author

@natabene Any updates on this? For planning purposes. 🙂

@natabene
Copy link
Contributor

natabene commented Oct 8, 2019

@swalladge No, no updates yet.

@cocococosti
Copy link
Contributor

Hi! We tested this at eduNEXT and works great 👍 thank you

@marcotuts
Copy link
Contributor

Ok to move past product review for eng review, thanks!

@openedx-webhooks openedx-webhooks added awaiting prioritization and removed product review PR requires product review before merging labels Feb 20, 2020
@natabene
Copy link
Contributor

@swalladge Moving to engineering review

Copy link
Contributor

@ormsbee ormsbee left a comment

Choose a reason for hiding this comment

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

I'm honestly not crazy about adding a way to explicitly bypass password policy like this (and adding a feature flag on top of that). But our handling of auth_user is idiosyncratic enough, and this use case is likely common enough where I'm okay with it. Doing a feature flag is definitely the right way to do this btw – even if it wasn't required at startup time to do urls.py manipulation.

Just one required change request, and then please do the normal squash + copying the context from your PR message to your commit message, and I'll merge. Thank you.

cms/urls.py Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add this flag to common.py for both the lms and cms envs, defaulting to False. Please also follow the feature flag annotation format (example: https://github.com/edx/edx-platform/blob/master/lms/envs/common.py#L180-L191)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ormsbee ! I have added the flag to the common.py files and tidied the commits.

@samuelallan72 samuelallan72 force-pushed the samuel/gate-change-password branch from 22e4597 to efa2d44 Compare February 21, 2020 00:52
This was previously disabled because changing another user's password is
both not usually recommended and bypasses password policy. Here, we add
a feature flag (`ENABLE_CHANGE_USER_PASSWORD_ADMIN`) to allow
re-enabling this password change form. This allows continued use of this
functionality by clients that require it.
@samuelallan72 samuelallan72 force-pushed the samuel/gate-change-password branch from efa2d44 to 39de23c Compare February 21, 2020 00:55
@ormsbee
Copy link
Contributor

ormsbee commented Feb 21, 2020

jenkins run bokchoy

@ormsbee ormsbee merged commit 0d3d680 into openedx:master Feb 21, 2020
@openedx-webhooks
Copy link

@swalladge 🎉 Your pull request was merged!

Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

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

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR may have caused e2e tests to fail on Stage. If you're a member of the edX org, please visit #e2e-troubleshooting on Slack to help diagnose the cause of these failures. Otherwise, it is the reviewer's responsibility. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/deploy_to_stage

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants