Skip to content

Add the _failure_path hidden field in template #7620

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

Merged
merged 3 commits into from
Apr 15, 2017

Conversation

damienalexandre
Copy link
Contributor

Today I learnt about this feature so I guess it was time to document it.

Basically, what we can do with the _target_path form field is also possible for failure via the _failure_path field. It's very useful when you want multiple login forms for the same firewall (a general login, and a login during e-commerce checkout for example).

I also moved the sections to me more logic, as the last section was about Redirecting on Login Failure via the option - because it was not explained yet in the page. This section is now just before the updated Control the Redirect URL from inside the Form.

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

👍

@damienalexandre I didn't know about this option either! Thanks for documenting it!

I proposed some minor rewords to simplify some explanations ... but your PR was great. Cheers!

@damienalexandre
Copy link
Contributor Author

Thanks for the changes, looks better to me 👍

Copy link
Contributor

@HeahDude HeahDude left a comment

Choose a reason for hiding this comment

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

👍

back to the login form itself. You can set this to a different route (e.g.
``login_failure``) with the following config:
After a failed login (e.g. an invalid username or password was submitted), the
user is redirected back to the login form itself. Use the ``failure_path``
Copy link
Member

Choose a reason for hiding this comment

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

_failure_path ?

Copy link
Member

Choose a reason for hiding this comment

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

The parameter with the leading _ is when using the hidden form field, right? Otherwise you don't have to prefix the _.

@xabbuh
Copy link
Member

xabbuh commented Apr 15, 2017

Thank you @damienalexandre.

@xabbuh xabbuh merged commit a865da1 into symfony:2.7 Apr 15, 2017
xabbuh added a commit that referenced this pull request Apr 15, 2017
…lexandre, javiereguiluz)

This PR was merged into the 2.7 branch.

Discussion
----------

Add the `_failure_path` hidden field in template

Today I learnt about this [feature](symfony/symfony@d0057d0) so I guess it was time to document it.

Basically, what we can do with the `_target_path` form field is also possible for failure via the `_failure_path` field. It's very useful when you want multiple login forms for the same firewall (a general login, and a login during e-commerce checkout for example).

I also moved the sections to me more logic, as the last section was about **Redirecting on Login Failure** via the option - because it was not explained yet in the page. This section is now just before the updated **Control the Redirect URL from inside the Form**.

Commits
-------

a865da1 Use different values for target_path_parameter and failure_path_parameter
1fc80af Minor rewords
93cf9bd Add the `_failure_path` hidden field in template
xabbuh added a commit that referenced this pull request Apr 15, 2017
* 2.7:
  [#7620] use generate() in PHP templates before 2.8
xabbuh added a commit that referenced this pull request Apr 15, 2017
* 2.8: (46 commits)
  [#7507] fix component name
  [#7490] minor typo fix
  Added a note about redirections to absolute URLs in tests
  Added the changes suggested by reviewers
  [#7620] use generate() in PHP templates before 2.8
  Fixed the RST syntax
  Improve example context
  [#5621] Enhancing example of using bundle config
  [#7601] minor tweak
  Update expiration.rst
  Update expiration.rst
  Update expiration.rst
  Update expiration.rst
  Minor reword and fixed the line length
  Improve specification explanation
  [#7664] minor wording tweak
  Rewords and minor fixes
  Add an explanation about «constraints» validation
  [#7645] enumerate ordered list items implicitly
  Adding a new article about "Creating a Bug Reproducer"
  ...
weaverryan added a commit that referenced this pull request Apr 15, 2017
* 3.2: (71 commits)
  Rewriting the service container docs
  Minor reword
  Adding a tip for validation in forms without class
  [#7217] add versionadded directives
  [#7203] merge note and versionadded directive
  Use the new configurator YAML syntax
  Added a note about the .htaccess files included by Symfony apps
  Made unmapped field example in forms chapter more descriptive
  [#7507] fix namespace
  [#7507] fix component name
  [#7490] minor typo fix
  Added a note about redirections to absolute URLs in tests
  [#7204] link to API doc
  Added docs for JsonResponse::fromJsonString
  Added the changes suggested by reviewers
  [#7620] use generate() in PHP templates before 2.8
  Fixed the RST syntax
  Improve example context
  Minor formatting changes
  [#7519] some minor tweaks
  ...
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.

6 participants