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

Feature Request: Add actions in recaptcha v3 widget #304

Conversation

alexrobertson-muckrack
Copy link
Contributor

Replaces #233

Closes #209 @binoyudayan did all of the work but I'm assuming was waiting for a response on the issue before creating a PR.
This would be a nice feature providing action support

Which from the docs has the benefits of:

A detailed break-down of data for your top ten actions in the admin console
Adaptive risk analysis based on the context of the action, because abusive behavior can vary.

Resolves a merge conflict in the original PR

@Andrew-Chen-Wang
Copy link
Member

thanks mint error tho

Binoy Udayan added 2 commits September 11, 2023 15:31

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@alexrobertson-muckrack
Copy link
Contributor Author

@Andrew-Chen-Wang Can you clarify what you mean by "mint error"?

@Andrew-Chen-Wang
Copy link
Member

sorry lint error*

@alexrobertson-muckrack
Copy link
Contributor Author

It looks like a problem with the build process

build attempt 1...
    => error
    [INFO] Installing environment for https://github.com/pycqa/isort.
    [INFO] Once installed this environment will be reused.
    [INFO] This may take a few minutes...
    An unexpected error has occurred: CalledProcessError: command: ('/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/bin/python', '-mpip', 'install', '.')
    return code: 1
    stdout:
        Processing /pc/clone/wvVSBsjfSEmrVJ2f-s2wow
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'error'
    stderr:
          error: subprocess-exited-with-error
      
          × Preparing metadata (pyproject.toml) did not run successfully.
          │ exit code: 1
          ╰─> [17 lines of output]
              Traceback (most recent call last):
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
                  main()
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
                  json_out['return_val'] = hook(**hook_input['kwargs'])
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
                  return hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-ubgl9gzj/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 41, in prepare_metadata_for_build_wheel
                  poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-ubgl9gzj/overlay/lib/python3.11/site-packages/poetry/core/factory.py", line 58, in create_poetry
                  raise RuntimeError("The Poetry configuration is invalid:\n" + message)
              RuntimeError: The Poetry configuration is invalid:
                - [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'
          
              [end of output]
      
          note: This error originates from a subprocess, and is likely not a problem with pip.
        error: metadata-generation-failed
    
        × Encountered error while generating package metadata.
        ╰─> See above for output.
    
        note: This is an issue with the package mentioned above, not pip.
        hint: See above for details.
    Check the log at /pc/pre-commit.log
build attempt 2...
    => error
    [INFO] Installing environment for https://github.com/pycqa/isort.
    [INFO] Once installed this environment will be reused.
    [INFO] This may take a few minutes...
    An unexpected error has occurred: CalledProcessError: command: ('/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/bin/python', '-mpip', 'install', '.')
    return code: 1
    stdout:
        Processing /pc/clone/wvVSBsjfSEmrVJ2f-s2wow
          Installing build dependencies: started
          Installing build dependencies: finished with status 'done'
          Getting requirements to build wheel: started
          Getting requirements to build wheel: finished with status 'done'
          Preparing metadata (pyproject.toml): started
          Preparing metadata (pyproject.toml): finished with status 'error'
    stderr:
          error: subprocess-exited-with-error
      
          × Preparing metadata (pyproject.toml) did not run successfully.
          │ exit code: 1
          ╰─> [17 lines of output]
              Traceback (most recent call last):
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
                  main()
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
                  json_out['return_val'] = hook(**hook_input['kwargs'])
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/pc/clone/wvVSBsjfSEmrVJ2f-s2wow/py_env-python3/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
                  return hook(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-wthpukp9/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 41, in prepare_metadata_for_build_wheel
                  poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/tmp/pip-build-env-wthpukp9/overlay/lib/python3.11/site-packages/poetry/core/factory.py", line 58, in create_poetry
                  raise RuntimeError("The Poetry configuration is invalid:\n" + message)
              RuntimeError: The Poetry configuration is invalid:
                - [extras.pipfile_deprecated_finder.2] 'pip-shims<=0.3.4' does not match '^[a-zA-Z-_.0-9]+$'
          
              [end of output]
      
          note: This error originates from a subprocess, and is likely not a problem with pip.
        error: metadata-generation-failed
    
        × Encountered error while generating package metadata.
        ╰─> See above for output.
    
        note: This is an issue with the package mentioned above, not pip.
        hint: See above for details.
    Check the log at /pc/pre-commit.log

This error is showing up in other recent PRs as well.

@alexrobertson-muckrack alexrobertson-muckrack marked this pull request as ready for review September 12, 2023 13:53
@alexrobertson-muckrack
Copy link
Contributor Author

@Andrew-Chen-Wang I tried the PR checks again and they passed this time.

@Andrew-Chen-Wang Andrew-Chen-Wang merged commit 14934d0 into django-recaptcha:main Sep 19, 2023
@Andrew-Chen-Wang
Copy link
Member

thanks!

@cbracco
Copy link

cbracco commented Sep 19, 2023

Thanks for merging this, @Andrew-Chen-Wang! Any idea when we can expect a new release to be published?

@Andrew-Chen-Wang
Copy link
Member

I don't think i have publishing permission.

@cbracco
Copy link

cbracco commented Sep 19, 2023

Looks like @Stormheg handled the last release? https://github.com/torchbox/django-recaptcha/releases/tag/3.0.0

@Stormheg
Copy link
Contributor

I should be able to create a new release, like I did last year.

I do have some points I'd like to see addressed before releasing this:

  1. The new 'action' argument to the ReCaptchaV3 widget is not documented. There should be documentation referencing the recaptcha docs on what this argument does and how to use it.
  2. The recaptcha docs explicitly mention that we should check the action name in the recaptcha response is the same as we expect. I don't see any code in this PR that does so. (not sure why validating this is so important, but with such explicit mention of it there must be a good reason...)
  3. Question: the action is now always specified with a default value of 'form'. Should this not be opt-in?

@alexrobertson-muckrack
Copy link
Contributor Author

alexrobertson-muckrack commented Sep 28, 2023

@Stormheg I've addressed point 2 in #310

As for point 3: the action was always required by the V3 API and the default has been form. This cannot be opt-in. The library could perhaps throw an error if not provided a action value, but that seems like it would be a breaking change.

@Stormheg
Copy link
Contributor

As for point 3: the action was always required by the V3 API and the default has been form. This cannot be opt-in.

@alexrobertson-muckrack alright, thanks! I wasn't aware this has always been the default.

@cbracco
Copy link

cbracco commented Oct 10, 2023

@Stormheg any updates on when a release for this might go out? thanks again for merging 😄

@Stormheg
Copy link
Contributor

@cbracco not sure when a new release will be out. Right now I'm waiting for review and feedback on #312 from another maintainer.

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

Successfully merging this pull request may close these issues.

Adding actions in ReCaptchaV3 widget
4 participants