Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Fix regression in credit card deleting (#211)
Browse files Browse the repository at this point in the history
The button to delete one's credit card did not get updated when we added
the CSRF fix (#88).
  • Loading branch information
chadwhitacre committed Aug 1, 2012
1 parent 83f78f3 commit 037f38f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
24 changes: 20 additions & 4 deletions www/assets/%version/gittip.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,30 @@ Gittip.paymentProcessorAttempts = 0;

Gittip.submitDeleteForm = function(e)
{
e.stopPropagation()
e.preventDefault()

if (!confirm("Really delete your credit card details?"))
{
e.stopPropagation();
e.preventDefault()
return false;
}

jQuery.ajax(
{ url: '/credit-card.json'
, data: {action: "delete"}
, type: "POST"
, success: function() {
window.location.href = "/credit-card.html";
}
, error: function(x,y,z) {
select(cur);
alert("Sorry, something went wrong deleting your credit card. :(");
console.log(x,y,z);
}
}
);
return false;
};


Gittip.submitPaymentForm = function(e)
{
e.stopPropagation();
Expand Down
4 changes: 2 additions & 2 deletions www/credit-card.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ <h2>Delete credit card.</h2>
<p>Your credit card details will immediately be completely purged from
Gittip.</p>

<form action="credit-card.json" class="special">
<input type="hidden" name="action" value="delete">
<form action="credit-card.json" class="special" method="POST">
<input type="hidden" name="action" value="delete">
<button>Delete my credit card</button>
</form>
</div>
Expand Down

0 comments on commit 037f38f

Please sign in to comment.