mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-04 22:24:42 +09:00
Created a CSRF token system (#526)
* Implement a basic CSRF token system * Update forms for all modules * Added to the theme forms * Create a config option for CSRF prevention * Slightly rework the filter * Let's actually use a global var * Added the token to API hrefs * Fixup * Remove old reference * Added the token to the installer twig globals * The token isn't actually needed in the installer * Fix client searching * Whoops - those need quotes
This commit is contained in:
1 parent
5979a6bfb0
commit
8821d50cff
122 files changed
+326
-110
No files matched your search
@@ -111,12 +111,13 @@
|
||||
{% endif %}
|
||||
|
||||
<form action="guest/cart/apply_promo" method="post" class="well" id="apply-promo" data-api-reload="1" {% if not cart.promocode %}style="display:none"{% endif %}>
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
<div class="control-group">
|
||||
<div class="form-controls">
|
||||
<div class="input-append">
|
||||
<input class="span8" type="text" name="promocode" id="promocode" value="{{ request.promocode|default(cart.promocode) }}" {% if promo.required %}required="required"{% endif %} placeholder="{{ 'Enter code'|trans }}">
|
||||
{% if cart.promocode %}
|
||||
<button class="btn" id="remove-promo" href="{{ 'api/guest/cart/remove_promo'|link }}" type="button" data-api-reload="1">{{ 'Remove'|trans }}</button>
|
||||
<button class="btn" id="remove-promo" href="{{ 'api/guest/cart/remove_promo'|link({ 'CSRFToken': CSRFToken }) }}" type="button" data-api-reload="1">{{ 'Remove'|trans }}</button>
|
||||
{% else %}
|
||||
<button class="btn" type="submit">{{ 'Apply'|trans }}</button>
|
||||
{% endif %}
|
||||
@@ -126,7 +127,7 @@
|
||||
{#
|
||||
<input type="text" class="search-query" name="promocode" value="{{ request.promocode|default(cart.promocode) }}" {% if promo.required %}required="required"{% endif %} placeholder="{{ 'Enter code'|trans }}">
|
||||
{% if cart.promocode %}
|
||||
<a href="{{ 'api/guest/cart/remove_promo'|link }}" class="btn btn-info api-link" data-api-reload="1" >{{ 'Remove '|trans }}(<strong>{{cart.promocode}}</strong>)</a>
|
||||
<a href="{{ 'api/guest/cart/remove_promo'|link({ 'CSRFToken': CSRFToken }) }}" class="btn btn-info api-link" data-api-reload="1" >{{ 'Remove '|trans }}(<strong>{{cart.promocode}}</strong>)</a>
|
||||
{% else %}
|
||||
<button class="btn btn-info" type="submit"><span class="awe-gift"></span> {{ 'Apply'|trans }}</button>
|
||||
{% endif %}
|
||||
@@ -165,6 +166,7 @@
|
||||
</table>
|
||||
|
||||
<form method="post" action="client/cart/checkout" class="form-horizontal" id="checkout-form" onsubmit="return false;">
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
<fieldset>
|
||||
{% set enough_in_balance = client.client_balance_get_total >= cart.total %}
|
||||
{% if cart.total and not enough_in_balance %}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="login-tab">
|
||||
<form method="post" action="" id="client-login">
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="email">{{ 'Email Address'|trans }}</label>
|
||||
@@ -40,6 +41,7 @@
|
||||
</div>
|
||||
<div class="tab-pane" id="register-tab">
|
||||
<form action="" method="post" id="create-profile">
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
{% set r = guest.client_required %}
|
||||
<fieldset>
|
||||
<div class="control-group">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div id="order" class="accordion-body collapse {% if request.order%}in{%endif%}">
|
||||
<div class="accordion-inner">
|
||||
<form method="post" style="background:none;" class="form-{{ product.form_id ? guest.formbuilder_get( {"id":product.form_id}).style.type : 0 }}" action="{{ '/order'|link }}/{{ product.slug }}" id="add-to-cart" onsubmit="return false;">
|
||||
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
{% set product_details %}
|
||||
<div class="well">
|
||||
<strong>{{ product.title }}</strong>
|
||||
|
||||
Reference in new issue
Block a user