mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 12:18:43 +09:00
Merge pull request #545 from BelleNottelling/patch-1
Hotfix for issues caused by the CSRF token system
This commit is contained in:
18 files changed
+36
-36
No files matched your search
@@ -209,7 +209,7 @@
|
||||
var price = $('input[name="amount"]').val();
|
||||
var code = $('select[name="to"]').val();
|
||||
|
||||
bb.post('guest/currency/format', { price: price, code: code }, function(result) {
|
||||
bb.post('guest/currency/format', { price: price, code: code, CSRFToken: "{{ CSRFToken }}" }, function(result) {
|
||||
$('#converted_result').val(result);
|
||||
});
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ Accessing Admin API can get information about your FOSSBilling, for example how
|
||||
$(function() {
|
||||
$('.epb').click(function() {
|
||||
var r = $(this).siblings('.example-preview');
|
||||
var params = { _tpl: $(this).siblings('textarea').val(), id: '{{ template.id }}' };
|
||||
var params = { _tpl: $(this).siblings('textarea').val(), id: '{{ template.id }}', CSRFToken: "{{ CSRFToken }}" };
|
||||
|
||||
bb.post('admin/email/template_render', params, function(result) {
|
||||
r.html(result).show();
|
||||
@@ -246,14 +246,14 @@ $(function() {
|
||||
});
|
||||
|
||||
$('#preview-button').click(function() {
|
||||
var params = { _tpl: $('#email-template').val(), id: '{{ template.id }}' };
|
||||
var params = { _tpl: $('#email-template').val(), id: '{{ template.id }}', CSRFToken: "{{ CSRFToken }}" };
|
||||
|
||||
bb.post('admin/email/template_render', params, function(result) {
|
||||
$('#preview').show();
|
||||
$('#preview .econtent').html(result);
|
||||
});
|
||||
|
||||
var params = { _tpl: $('#email-subject').val(), id: '{{ template.id }}' };
|
||||
var params = { _tpl: $('#email-subject').val(), id: '{{ template.id }}', CSRFToken: "{{ CSRFToken }}" };
|
||||
|
||||
bb.post('admin/email/template_render', params, function(result) {
|
||||
$('#preview').show();
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
bb.post(
|
||||
'client/email/resend',
|
||||
{ id: email_id },
|
||||
{ id: email_id, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
$('.wait').hide();
|
||||
bb.msg('Email resent');
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
bb.post(
|
||||
'client/email/delete',
|
||||
{ id: email_id },
|
||||
{ id: email_id, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Email deleted');
|
||||
bb.redirect('{{ 'email'|link }}');
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
var email_id = $(this).attr('mail-id');
|
||||
bb.post(
|
||||
'client/email/resend',
|
||||
{id: email_id },
|
||||
{id: email_id, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
$('.wait').hide();
|
||||
bb.msg('Email resent');
|
||||
@@ -79,7 +79,7 @@
|
||||
var email_id = $(this).attr('mail-id');
|
||||
bb.post(
|
||||
'client/email/delete',
|
||||
{id: email_id },
|
||||
{id: email_id, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Email deleted');
|
||||
bb.redirect('{{ 'email'|link }}');
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
|
||||
jConfirm('Are you sure?', 'Confirm', function(r) {
|
||||
if(r) {
|
||||
bb.post('admin/formbuilder/delete_field', {id: fid}, function () {
|
||||
bb.post('admin/formbuilder/delete_field', {id: fid, CSRFToken: "{{ CSRFToken }}"}, function () {
|
||||
$(rm).parents('.wrap-field').slideUp("normal", function () {
|
||||
$(rm).remove();
|
||||
});
|
||||
@@ -329,7 +329,7 @@
|
||||
$('#new-form').click(function () {
|
||||
jPrompt('Give your new form a title', 'My new form', 'Form title', function (title) {
|
||||
if (title) {
|
||||
bb.post('admin/formbuilder/create_form', { name: title }, function (id) {
|
||||
bb.post('admin/formbuilder/create_form', { name: title, CSRFToken: "{{ CSRFToken }}" }, function (id) {
|
||||
bb.redirect("{{ 'extension/settings/formbuilder'|alink({ 'id': '' }) }}" + id);
|
||||
});
|
||||
}
|
||||
@@ -343,7 +343,7 @@
|
||||
|
||||
jPrompt('Give your new form a title', 'My new form', 'Form title', function (title) {
|
||||
if (title) {
|
||||
bb.post('admin/formbuilder/copy_form', { name: title, form_id: fid }, function (id) {
|
||||
bb.post('admin/formbuilder/copy_form', { name: title, form_id: fid, CSRFToken: "{{ CSRFToken }}" }, function (id) {
|
||||
bb.redirect("{{ 'extension/settings/formbuilder'|alink({ 'id': '' }) }}" + id);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
{% autoescape "js" %}
|
||||
<script>
|
||||
function onAfterMessageUpdate() {
|
||||
bb.post('admin/massmailer/preview', { id: '{{ msg.id }}' }, function(result) {
|
||||
bb.post('admin/massmailer/preview', { id: '{{ msg.id }}', CSRFToken: "{{ CSRFToken }}" }, function(result) {
|
||||
$('#preview').show();
|
||||
$('#preview .econtent').html(result.content);
|
||||
$('#preview .esubject').html(result.subject);
|
||||
@@ -120,7 +120,7 @@ $(function() {
|
||||
$('#send-msg').click(function() {
|
||||
jConfirm('Send message to clients?', 'Confirm', function(confirm) {
|
||||
if (confirm) {
|
||||
bb.post('admin/massmailer/send', { id: {{ msg.id }} }, function(result) {
|
||||
bb.post('admin/massmailer/send', { id: {{ msg.id, CSRFToken: "{{ CSRFToken }}" }} }, function(result) {
|
||||
bb.msg("{{ 'Message was added to mail queue and will be sent with scheduled tasks.'|trans }}");
|
||||
});
|
||||
}
|
||||
@@ -132,7 +132,7 @@ $(function() {
|
||||
$('#send-test-msg').click(function() {
|
||||
jConfirm('Send test message?', 'Confirm', function(confirm) {
|
||||
if (confirm) {
|
||||
bb.post('admin/massmailer/send_test', { id: {{ msg.id }} }, function(result) {
|
||||
bb.post('admin/massmailer/send_test', { id: {{ msg.id, CSRFToken: "{{ CSRFToken }}" }} }, function(result) {
|
||||
bb.msg("{{ 'Message was sent'|trans }}");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ $(function() {
|
||||
if (confirm("This will generate new invoice. Are you sure you want to continue?")) {
|
||||
bb.post(
|
||||
'client/invoice/renewal_invoice',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id, CSRFToken: "{{ CSRFToken }}" }} },
|
||||
function(result) {
|
||||
bb.redirect("{{ 'invoice'|link }}" + '/' + result);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
<script type="text/javascript">
|
||||
$('#remove-promo').click(function(e) {
|
||||
e.preventDefault();
|
||||
bb.post("guest/cart/remove_promo", {}, function(r) {
|
||||
bb.post("guest/cart/remove_promo", {CSRFToken: "{{ CSRFToken }}"}, function(r) {
|
||||
bb.msg("{{ 'Promo code was removed'|trans }}");
|
||||
location.reload(false);
|
||||
});
|
||||
@@ -215,7 +215,7 @@
|
||||
if (confirm("{{ 'Are you sure you want to remove this item from cart?'|trans }}")) {
|
||||
var item_id = $(btn).attr('data-cart-item-id');
|
||||
|
||||
bb.post("guest/cart/remove_item", { id: item_id }, function(r) {
|
||||
bb.post("guest/cart/remove_item", { id: item_id, CSRFToken: "{{ CSRFToken }}" }, function(r) {
|
||||
bb.msg("{{ 'Item was removed from cart'|trans }}");
|
||||
location.reload(false);
|
||||
});
|
||||
|
||||
@@ -258,7 +258,7 @@ $(function() {
|
||||
$('#domain-lock').bind('click', function(event) {
|
||||
bb.post(
|
||||
'admin/servicedomain/lock',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Domain locked'|trans }}");
|
||||
|
||||
@@ -274,7 +274,7 @@ $(function() {
|
||||
$('#domain-unlock').bind('click', function(event) {
|
||||
bb.post(
|
||||
'admin/servicedomain/unlock',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Domain unlocked'|trans }}");
|
||||
|
||||
@@ -302,7 +302,7 @@ $(function() {
|
||||
$('#domain-enable-pp').bind('click', function(event) {
|
||||
bb.post(
|
||||
'admin/servicedomain/enable_privacy_protection',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Privacy protection enabled'|trans }}");
|
||||
|
||||
@@ -320,7 +320,7 @@ $(function() {
|
||||
$('#domain-disable-pp').bind('click', function(event) {
|
||||
bb.post(
|
||||
'admin/servicedomain/disable_privacy_protection',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Privacy protection disabled'|trans }}");
|
||||
|
||||
@@ -338,7 +338,7 @@ $(function() {
|
||||
$('#get-epp').bind('click', function(event) {
|
||||
bb.post(
|
||||
'admin/servicedomain/get_transfer_code',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id, CSRFToken: "{{ CSRFToken }}" }} },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Domain transfer code is: '|trans }}" + result);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ $(function() {
|
||||
|
||||
bb.post(
|
||||
'client/servicedomain/lock',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Domain locked');
|
||||
$('#domain-lock').toggle();
|
||||
@@ -248,7 +248,7 @@ $(function() {
|
||||
|
||||
bb.post(
|
||||
'client/servicedomain/unlock',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Domain unlocked');
|
||||
$('#domain-lock').toggle();
|
||||
@@ -262,7 +262,7 @@ $(function() {
|
||||
|
||||
bb.post(
|
||||
'client/servicedomain/enable_privacy_protection',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Privacy Protection enabled');
|
||||
$('#domain-enable-pp').toggle();
|
||||
@@ -276,7 +276,7 @@ $(function() {
|
||||
|
||||
bb.post(
|
||||
'client/servicedomain/disable_privacy_protection',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Privacy Protection disabled');
|
||||
$('#domain-enable-pp').toggle();
|
||||
@@ -289,7 +289,7 @@ $(function() {
|
||||
event.preventDefault();
|
||||
bb.post(
|
||||
'client/servicedomain/get_transfer_code',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('Domain transfer code is: ' + result);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
$('#test-connection').click(function(){
|
||||
$('#server-update').submit();
|
||||
bb.post('admin/servicehosting/server_test_connection',
|
||||
{ id: {{ server.id }} },
|
||||
{ id: {{ server.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
FOSSBilling.message("{{ 'Successfully connected to server'|trans }}");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ $(function() {
|
||||
var domain = sld + tld;
|
||||
bb.post(
|
||||
'guest/servicedomain/check',
|
||||
{ sld: sld, tld: tld },
|
||||
{ sld: sld, tld: tld, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
setRegistrationPricing(tld);
|
||||
$('#domain-config').fadeIn('slow');
|
||||
@@ -107,7 +107,7 @@ $(function() {
|
||||
{
|
||||
bb.post(
|
||||
'guest/servicedomain/pricing',
|
||||
{ tld: tld },
|
||||
{ tld: tld, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
var s = $("select[name='domain[register_years]']");
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ $(function() {
|
||||
if (confirm("{{ 'Are you sure?'|trans }}")) {
|
||||
bb.post(
|
||||
'client/servicelicense/reset',
|
||||
{ order_id: {{ order.id }} },
|
||||
{ order_id: {{ order.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.msg('License was reset');
|
||||
}
|
||||
|
||||
@@ -362,7 +362,7 @@ $(function() {
|
||||
});
|
||||
|
||||
$('a.show-notes').click(function() {
|
||||
bb.post('admin/support/ticket_get', { id: $(this).attr('rel') }, function(result){
|
||||
bb.post('admin/support/ticket_get', { id: $(this).attr('rel'), CSRFToken: "{{ CSRFToken }}" }, function(result){
|
||||
var html = $('<div>');
|
||||
$.each(result.notes, function(i, v){
|
||||
html.append($('<div>').html(v.note));
|
||||
|
||||
@@ -145,7 +145,7 @@ $(function() {
|
||||
$('#new-ticket-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
bb.post("guest/support/ticket_close", { hash: '{{ ticket.hash }}' }, function(r) {
|
||||
bb.post("guest/support/ticket_close", { hash: '{{ ticket.hash }}', CSRFToken: "{{ CSRFToken }}" }, function(r) {
|
||||
bb.msg("Ticket was closed");
|
||||
bb.reload();
|
||||
});
|
||||
|
||||
@@ -189,7 +189,7 @@ $(function() {
|
||||
|
||||
bb.post(
|
||||
'client/support/ticket_close',
|
||||
{ id: {{ ticket.id }} },
|
||||
{ id: {{ ticket.id }}, CSRFToken: "{{ CSRFToken }}" },
|
||||
function(result) {
|
||||
bb.redirect("{{ 'support'|link }}");
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<label class="form-label col-3 col-form-label">{{ 'Your current preset'|trans }}:</label>
|
||||
<div class="col">
|
||||
<div class="input-group">
|
||||
<select class="form-select" name="preset" onchange="bb.post('admin/theme/preset_select', { code: '{{ theme_code }}', preset: $(this).val() }, function(){ bb.reload(); })">
|
||||
<select class="form-select" name="preset" onchange="bb.post('admin/theme/preset_select', { code: '{{ theme_code }}', preset: $(this).val(), CSRFToken: "{{ CSRFToken }}" }, function(){ bb.reload(); })">
|
||||
{% for preset in presets %}
|
||||
<option value="{{ preset }}"{% if preset == current_preset %} selected{% endif %}>{{ preset }}</option>
|
||||
{% endfor %}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
var ids = $('input.batch-delete-checkbox:checked').map(function() {
|
||||
return $(this).attr("data-item-id");
|
||||
}).get();
|
||||
bb.post('{{ action }}', { ids: ids }, function (result) {
|
||||
bb.post('{{ action }}', { ids: ids, CSRFToken: "{{ CSRFToken }}" }, function (result) {
|
||||
bb.reload();
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user