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

Commit

Permalink
Expose client authorization to envvar config
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Sep 8, 2017
1 parent 1afbd3a commit d6cb079
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions defaults.env
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ BRAINTREE_SANDBOX_MODE=true
BRAINTREE_MERCHANT_ID=ddnq29fv74cqxwkg
BRAINTREE_PUBLIC_KEY=f9xk4pb5ts86k67k
BRAINTREE_PRIVATE_KEY=36ded60b7f4a43ebc605ca5f4b33d909
BRAINTREE_CLIENT_AUTHORIZATION=sandbox_cr9dyy9c_bk8h97tqzyqjhtfn

COINBASE_API_KEY=uETKVUrnPuXzVaVj
COINBASE_API_SECRET=32zAkQCcHHYkGGn29VkvEZvn21PM1lgO
Expand Down
1 change: 1 addition & 0 deletions gratipay/wireup.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def env():
BRAINTREE_MERCHANT_ID = unicode,
BRAINTREE_PUBLIC_KEY = unicode,
BRAINTREE_PRIVATE_KEY = unicode,
BRAINTREE_CLIENT_AUTHORIZATION = unicode,
GITHUB_CLIENT_ID = unicode,
GITHUB_CLIENT_SECRET = unicode,
GITHUB_CALLBACK = unicode,
Expand Down
6 changes: 3 additions & 3 deletions js/gratipay/homepage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gratipay.homepage = {}

Gratipay.homepage.initForm = function () {
Gratipay.homepage.initForm = function(clientAuthorization) {
$form = $('#homepage #content form');
$submit= $form.find('button[type=submit]');
$submit.click(Gratipay.homepage.submitForm);
Expand All @@ -9,7 +9,7 @@ Gratipay.homepage.initForm = function () {
$promote.click(Gratipay.homepage.openPromote);

braintree.dropin.create({
authorization: 'sandbox_cr9dyy9c_bk8h97tqzyqjhtfn',
authorization: clientAuthorization,
container: '#braintree-container'
}, function (createErr, instance) {
$submit.click(function () {
Expand Down Expand Up @@ -51,7 +51,7 @@ jQuery.fn.extend({
toggleText:function(a,b){
if(this.html()==a){
this.html(b)
}
}
else {
this.html(a)
$('#promotion-fields :input').val('');
Expand Down
6 changes: 5 additions & 1 deletion www/index.spt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if not user.ANON:
{% endblock %}

{% block scripts %}
<script>$(document).ready(Gratipay.homepage.initForm);</script>
<script>
$(document).ready(function() {
Gratipay.homepage.initForm('{{ website.env.braintree_client_authorization }}');
});
</script>
{{ super() }}
{% endblock %}

Expand Down

0 comments on commit d6cb079

Please sign in to comment.