Howto: Dynamically generate CSRF-Token in WTForms with Flask

后端 未结 1 1605
孤独总比滥情好
孤独总比滥情好 2020-12-08 23:33

I have a fruits form that has one FieldList object for the bananas:

bananas = FieldList(FormField(BananaForm))

In the frontend, initially,

1条回答
  •  有刺的猬
    2020-12-08 23:56

    I discovered how it works:

    The CSRF-Tag can simply be copied. The id must be changed and incremented accordingly, but the hash may stay the same.

    I didn't think it was possible to have many Fields with the same CSRF-Tag hash, but it actually does!

    0 讨论(0)
提交回复
热议问题