mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
ensure card data is discarded after stripe token exists
This commit is contained in:
parent
ce0e9d422a
commit
8e77810fcf
2 changed files with 11 additions and 1 deletions
|
@ -14,7 +14,6 @@ end
|
|||
|
||||
post '/supporter/update' do
|
||||
require_login
|
||||
|
||||
plan_type = 'supporter'
|
||||
|
||||
if is_special_upgrade
|
||||
|
|
|
@ -19,16 +19,27 @@
|
|||
}, stripeResponseHandler);
|
||||
return false;
|
||||
} else {
|
||||
clearCardInfo();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function clearCardInfo() {
|
||||
$('[name="cc_number"]').val('');
|
||||
$('[name="cc_cvc"]').val('');
|
||||
$('[name="cc_exp_month"]').val('');
|
||||
$('[name="cc_exp_year"]').val('');
|
||||
$('[name="cc_name"]').val('');
|
||||
$('[name="cc_type"]').val('');
|
||||
}
|
||||
|
||||
function stripeResponseHandler(status, response) {
|
||||
if (response.error) {
|
||||
$('#plan_error').text(response.error.message).show();
|
||||
} else {
|
||||
var token = response.id;
|
||||
$('#stripe_token').val(token);
|
||||
clearCardInfo();
|
||||
$('#upgradeForm').off('submit').submit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue