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

Added support for custom CSRF cookie names#4049

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
jpadilla merged 1 commit intoencode:masterfromclintonb:csrf-cookie-fix
Apr 26, 2016
Merged

Added support for custom CSRF cookie names#4049

jpadilla merged 1 commit intoencode:masterfromclintonb:csrf-cookie-fix
Apr 26, 2016

Conversation

@clintonb
Copy link
Contributor

Instead of hardcoding the CSRF cookie name, the value is passed to the template as a context variable, rendered as a JavaScript variable, and read by csrf.js.

refs#4048

omni5cience reacted with thumbs up emojijpadilla and auvipy reacted with hooray emoji

{% block script %}
<script>
varcsrf_cookie_name="{{ csrf_cookie_name|default:'csrftoken' }}";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we instead do something like:

window.drf={csrfCookieName:"{{ csrf_cookie_name|default:'csrftoken' }}"};

and usewindow.drf.csrfCookieName incsrf.js?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated.

@jpadilla
Copy link
Contributor

Good stuff@clintonb, just left one small comment.

@jpadilla
Copy link
Contributor

This reminds me, I should probably do some house cleaning of our client side stuff.

Instead of hardcoding the CSRF cookie name, the value is passed to the template as a context variable, rendered as a JavaScript variable, and read by csrf.js.Fixes#4048
@clintonb
Copy link
ContributorAuthor

@jpadilla I addressed your comment. Let me know if any other changes are necessary to merge.

@jpadillajpadilla added this to the3.3.4 Release milestoneApr 26, 2016
@jpadillajpadilla merged commit4f16c54 intoencode:masterApr 26, 2016
@jpadilla
Copy link
Contributor

@clintonb thanks!

@clintonbclintonb deleted the csrf-cookie-fix branchApril 26, 2016 15:58
@xordoquyxordoquy modified the milestones:3.4.0 Release,3.3.4 ReleaseApr 27, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.4.0 Release

Development

Successfully merging this pull request may close these issues.

3 participants

@clintonb@jpadilla@xordoquy

[8]ページ先頭

©2009-2025 Movatter.jp