Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add block prefix to csrf token field#29862

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromalexander-schranz:patch-2
Jan 16, 2019

Conversation

@alexander-schranz
Copy link
Contributor

@alexander-schranzalexander-schranz commentedJan 12, 2019
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#...
LicenseMIT
Doc PRsymfony/symfony-docs#10867

Currently I use the following code snippet to overwrite the token rendering:

{%-blockhidden_widget -%}    {%-ifform.vars.name=='_token' -%}        {{block('app__token_widget') }}    {%-else -%}        {{block('hidden_widget','form_div_layout.html.twig') }}    {%-endif -%}{%-endblockhidden_widget -%}{%-blockapp__token_widget %}    {{ render_esi(controller('SuluFormBundle:FormWebsite:token', {'form':form.parent.vars.name })) }}{%-endblockapp__token_widget -%}

With the change ofhttps://symfony.com/blog/new-in-symfony-4-3-simpler-form-theming this workaround can now be removed and the following can be used:

{%-blocktoken_widget %}    {{ render_esi(controller('SuluFormBundle:FormWebsite:token', {'form':form.parent.vars.name })) }}{%-endblocktoken_widget -%}

onEXHovia, oliverde8, and vudaltsov reacted with thumbs up emoji

$csrfForm =$factory->createNamed($options['csrf_field_name'],'Symfony\Component\Form\Extension\Core\Type\HiddenType',$data,array(
$csrfForm =$factory->createNamed($options['csrf_field_name'],'Symfony\Component\Form\Extension\Core\Type\HiddenType',$data, [
'block_prefix' =>'token',

Choose a reason for hiding this comment

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

token ->csrf_token ?

alexander-schranz and HeahDude reacted with thumbs up emoji
@javiereguiluz
Copy link
Member

This looks nice to me ... but I'd like to ask@HeahDude and@vudaltsov if they can imagine any problem for adding this option unconditionally and for "hardcoding" its value. Thanks!

Copy link
Contributor

@HeahDudeHeahDude left a comment

Choose a reason for hiding this comment

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

This is a really simple and nice addition, thank you very much!

@fabpot
Copy link
Member

Thank you@alexander-schranz.

@fabpotfabpot merged commit02bd689 intosymfony:masterJan 16, 2019
fabpot added a commit that referenced this pull requestJan 16, 2019
This PR was squashed before being merged into the 4.3-dev branch (closes#29862).Discussion----------Add block prefix to csrf token field| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | #...| License       | MIT| Doc PR        |symfony/symfony-docs#10867Currently I use the following code snippet to overwrite the token rendering:```twig{%- block hidden_widget -%}    {%- if form.vars.name == '_token' -%}        {{ block('app__token_widget') }}    {%- else -%}        {{ block('hidden_widget', 'form_div_layout.html.twig') }}    {%- endif -%}{%- endblock hidden_widget -%}{%- block app__token_widget %}    {{ render_esi(controller('SuluFormBundle:FormWebsite:token', { 'form': form.parent.vars.name })) }}{%- endblock app__token_widget -%}```With the change ofhttps://symfony.com/blog/new-in-symfony-4-3-simpler-form-theming this workaround can now be removed and the following can be used:```twig{%- block token_widget %}    {{ render_esi(controller('SuluFormBundle:FormWebsite:token', { 'form': form.parent.vars.name })) }}{%- endblock token_widget -%}```Commits-------02bd689 Add block prefix to csrf token field
@alexander-schranzalexander-schranz deleted the patch-2 branchJanuary 16, 2019 10:19
@fabpotfabpot mentioned this pull requestMay 9, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@fabpotfabpotfabpot approved these changes

+2 more reviewers

@vudaltsovvudaltsovvudaltsov approved these changes

@HeahDudeHeahDudeHeahDude approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@alexander-schranz@javiereguiluz@fabpot@vudaltsov@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp