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

use ClassicEditor to upload image , I don't know how to set csrf headers #1959

Closed
juandx opened this issue Aug 14, 2019 · 1 comment
Closed
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it.

Comments

@juandx
Copy link

juandx commented Aug 14, 2019

Is this a bug report or feature request? (choose one)

Other

💻 Version of CKEditor

CKEditor5 version

📋 Steps to reproduce

1.use ClassicEditor to upload image , I don't know how to set csrf headers
2.this is my code in html, I use flask as backend

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CKEditor 5 - Classic editor</title>
    <script src="Public/home/js/ckeditor.js"></script>
</head>
<body>
    <h1>Classic editor</h1>
    <form action="/submit" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <textarea name="content" id="editor">
            &lt;p&gt;This is some sample content.&lt;/p&gt;
        </textarea>
        <p><input type="submit" value="Submit"></p>
    </form>
    <script>
        ClassicEditor
            .create( document.querySelector( '#editor' ), {
          
                ckfinder: {
                    uploadUrl: "/upload",
                    headers: {XcsrfToken: '{{ csrf_token() }}'}
                }
            })
            .catch( error => {
                console.error( error );
            } );
    </script>
</body>
@Mgsy
Copy link
Member

Mgsy commented Aug 14, 2019

Hello, CKFinder has own CSRF protection. Actually, this topic was raised some time ago, please take a look at following ticket - #887 (comment) to get more details.

@Mgsy Mgsy closed this as completed Aug 14, 2019
@Mgsy Mgsy added the resolution:duplicate This issue is a duplicate of another issue and was merged into it. label Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it.
Projects
None yet
Development

No branches or pull requests

2 participants