File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,14 @@ export default class AutoCheckElement extends HTMLElement {
8686 this . removeAttribute ( 'required' )
8787 }
8888 }
89+
90+ get csrfField ( ) : string {
91+ return this . getAttribute ( 'csrf-field' ) || 'authenticity_token'
92+ }
93+
94+ set csrfField ( value : string ) {
95+ this . setAttribute ( 'csrf-field' , value )
96+ }
8997}
9098
9199function setLoadingState ( event : Event ) {
@@ -151,6 +159,7 @@ async function check(autoCheckElement: AutoCheckElement) {
151159 return
152160 }
153161
162+ const csrfField = autoCheckElement . csrfField
154163 const src = autoCheckElement . src
155164 const csrf = autoCheckElement . csrf
156165 const state = states . get ( autoCheckElement )
@@ -171,7 +180,7 @@ async function check(autoCheckElement: AutoCheckElement) {
171180 }
172181
173182 const body = new FormData ( )
174- body . append ( 'authenticity_token' , csrf )
183+ body . append ( csrfField , csrf )
175184 body . append ( 'value' , input . value )
176185
177186 input . dispatchEvent (
You can’t perform that action at this time.
0 commit comments