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

Fix bugs for error response in the form_post and error view #1702

Merged
merged 2 commits into from
Mar 26, 2024

Commits on Mar 22, 2024

  1. Fix bugs for error response in the form_post and error view

    Bug
    When an error is rendered with the `form_post.html.erb` view, an empty
    form is posted instead of the correct error and error_description.
    
    Root cause
    The form_post view used the body of `@authorize_response`. However,
    the `redirect_or_render` could be called with `authorization.deny` or
    `pre_auth.error_response`. In this case, `@authorize_response` would
    only contain an empty body.
    
    Fix
    Instead of using `@authorize_response`, we pass in a local variable
    `auth` to the `form_post.html.erb`, which corresponding to the auth
    object passed into the redirect_or_render function. Tests are backfilled
    to the authorizations controller spec.
    
    During the test phase, I discovered error.html.erb always renders an
    incorrect error description. It turns out that `respond_to(:error_respon
    se)` always return false in the view. I changed it to use
    `local_assigns` as the correct condition.
    lurz committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    a888789 View commit details
    Browse the repository at this point in the history
  2. Add CHANGELOG

    lurz committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4cea951 View commit details
    Browse the repository at this point in the history