Skip to content

Commit 8dca77a

Browse files
Removed access token in cookie.
Storing "encrypted" access token in cookie was not secure. Removed the cookie and now we make a request to the middleware for the acccess token on each request that requires it.
1 parent a31f1c5 commit 8dca77a

File tree

14 files changed

+393
-207
lines changed

14 files changed

+393
-207
lines changed

actions/accounts.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ function receiveAccount(account_id = null, json) {
3636
}
3737
}
3838

39-
function fetchAccount(account_id = null) {
39+
function fetchAccount(email=null, account_id = null) {
4040
return dispatch => {
4141
dispatch(requestAccount(account_id));
4242

43-
return $.post("/account", {"account_id":account_id})
43+
return $.post("/account", {"email":email, "account_id":account_id})
4444
.fail(function(data){
4545
console.log("ERROR: ", data);
4646
var error_data = data.responseJSON;
@@ -63,10 +63,10 @@ function shouldFetchAccount(state, account_id = null) {
6363
return false;
6464
}
6565

66-
export function fetchAccountIfNeeded(account_id=null) {
66+
export function fetchAccountIfNeeded(email=null, account_id=null) {
6767
return (dispatch, getState) => {
6868
if (shouldFetchAccount(getState(), account_id)) {
69-
return dispatch(fetchAccount(account_id))
69+
return dispatch(fetchAccount(email, account_id))
7070
}
7171
}
7272
}

actions/checkouts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ function receiveRefund(checkout_id, data) {
6060
}
6161
}
6262

63-
function requestRefund(checkout_id, amount=null, refund_reason) {
63+
function requestRefund(account_id, checkout_id, amount=null, fee_refund = null, refund_reason) {
6464
return dispatch => {
65-
dispatch(refundCheckout(checkout_id, amount, refund_reason))
66-
return $.post("/refund", {"checkout_id": checkout_id, "amount":amount, "refund_reason":refund_reason})
65+
dispatch(refundCheckout(checkout_id, amount, fee_refund, refund_reason))
66+
return $.post("/refund", {"account_id": account_id, "checkout_id": checkout_id, "amount":amount, "app_fee":fee_refund, "refund_reason":refund_reason})
6767
.fail(function(data){
6868
console.log("ERROR: ", data);
6969
var error_data = data.responseJSON;
@@ -77,7 +77,7 @@ function requestRefund(checkout_id, amount=null, refund_reason) {
7777
dispatch(clearError());
7878

7979
// update the checkout data for this checkout
80-
dispatch(fetchCheckoutIfNeeded(null, checkout_id));
80+
dispatch(fetchCheckoutIfNeeded(account_id, checkout_id));
8181
})
8282
}
8383
}
@@ -136,10 +136,10 @@ function shouldRefundCheckout(state, checkout_id, amount) {
136136
return false;
137137
}
138138

139-
export function fetchRefundIfNeeded(checkout_id, amount, refund_reason) {
139+
export function fetchRefundIfNeeded(email, checkout_id, amount, fee_refund, refund_reason) {
140140
return(dispatch, getState) => {
141141
if(shouldRefundCheckout(getState(), checkout_id, amount)) {
142-
return dispatch(requestRefund(checkout_id, amount, refund_reason))
142+
return dispatch(requestRefund(email, checkout_id, amount, fee_refund,refund_reason))
143143
}
144144
}
145145
}

components/Accounts.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ var AccountBlock= React.createClass({
3434
onSelect: this.handleClick
3535
}
3636
}
37+
},
38+
accountPopover: function(row) {
39+
console.log("Rollover!");
40+
41+
$("#account_table .react-bs-table").attr({
42+
"data-placement": "top",
43+
"data-content": row.action_reasons_0.toString()
44+
});
45+
console.log((<p>{row.action_reasons_0}</p>))
46+
$("#account_table .react-bs-table").popover("show")
47+
},
48+
formatBalance: function(cell, row) {
49+
3750
},
3851
/**
3952
* Defines the behavior when a row in the table is selected
@@ -94,12 +107,13 @@ var AccountBlock= React.createClass({
94107
<div id="account_table">
95108
<h4> Account Details </h4>
96109
<BootstrapTable
110+
id="account_data"
97111
data = {accounts}
98112
striped={true}
99113
hover={true}
100114
pagination={true}
101115
selectRow = {this.state.selectRowProp}
102-
width="99%"
116+
ref="account_data"
103117
>
104118
<TableHeaderColumn
105119
dataField="name"
@@ -112,8 +126,15 @@ var AccountBlock= React.createClass({
112126
>
113127
Account Id
114128
</TableHeaderColumn>
129+
<TableHeaderColumn
130+
dataField="create_time"
131+
dataFormat={Base.formatDate}
132+
>
133+
Create Time
134+
</TableHeaderColumn>
115135
<TableHeaderColumn
116136
dataField="balances_0_balance"
137+
dataFormat={this.formatBalance}
117138
>
118139
Balance ({accounts[0] ? accounts[0].balances_0_currency : "Currency"})
119140
</TableHeaderColumn>
@@ -145,7 +166,7 @@ const mapStateToProps = (state) => {
145166
isFetching: state.wepay_account.account.isFetching,
146167
searchedAccount: state.wepay_account.searchedAccount,
147168
haveAccessToken: state.wepay_user.user.haveAccessToken,
148-
error: state.errors.account ? state.errors.account.info : {}
169+
error: state.errors.account ? state.errors.account.info : {},
149170
}
150171
}
151172

0 commit comments

Comments
 (0)