Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jlc/palm mig/patch generate passwords #130

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

johanseto
Copy link
Collaborator

@johanseto johanseto commented Feb 5, 2024

Description

This PR is a monkey patch to generate_password.
This was a PR of edx-platform but now this is included in eox-nelp.

As the feature of the PR needs django-password-validators this PR add to eox-nelp the possibility to install it.

Also edx-django-utils is included in requirements, but is a normal package of edx-platform.

I added a logger to know that the password is generated via eox-nelp.

Testing instructions

  • install this package with this branch

  • Configure auth password validators in settings with custom rules, you could use this as eg.

AUTH_PASSWORD_VALIDATORS = [
...
]
  • add django-password-validators in installed apps.
INSTALLED_APPS += [
    "django_password_validators",
    "django_password_validators.password_history",
]
  • Check into /register in the password field that you custom rules are loaded.
    image

  • Use a saml integration in your local env and complete a register flow, then check that the process is complete without problem. Check into logs that eox-nelp geneate the password.
    image

After

Screencast.from.05-02-24.15.44.04.webm

Additional information

PRs related
nelc/edx-platform#4
eduNEXT/edunext-platform#676

Copy link
Collaborator

@andrey-canon andrey-canon left a comment

Choose a reason for hiding this comment

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

LGTM, please rebase, add this feature to the testing list and verify its behavior in alpha

@johanseto johanseto force-pushed the jlc/palm-mig/patch-generate-passwords branch from 65f43eb to c5e16ed Compare February 29, 2024 19:56
feat: first version of monkey patching

feat: add django-password-validators==1.7.3

This is the latest (now), feb5-2024

feat: add edx-django-utils pck

feat: add generate password to init pipeline

chore: add natural docstring

style: pylint and isort

feat: add logging msg of generation password

feat: add edx-django-utils

style: pass flake8 long line error

chore: remove duplicated req
@andrey-canon andrey-canon force-pushed the jlc/palm-mig/patch-generate-passwords branch from c5e16ed to f925718 Compare March 1, 2024 21:38
@andrey-canon andrey-canon merged commit ce851f3 into master Mar 1, 2024
7 checks passed
Comment on lines +93 to +96
from edx_django_utils import user

from eox_nelp.user_authn.utils import generate_password
user.generate_password = generate_password

Choose a reason for hiding this comment

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

Thanks @johanseto for the fix today.

I believe we should patch the generate password locally inside the importing modules:

from lms.djangoapps.support.views import manage_user
manage_user.generate_password = generate_password

Otherwise the imports won't be updated in manage_user due to the patch being too late in the import order.

What do you think?

Choose a reason for hiding this comment

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

Forking edx_django_utils is also an option.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @OmarIthawi the patching locally is managed this PR.
https://github.com/eduNEXT/eox-nelp/pull/208/files
Is doing what you recommend using eox-tenant and seems working. Let us check out the behavior.

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

Successfully merging this pull request may close these issues.

3 participants