Skip to content

Commit 17044ac

Browse files
authored
Merge pull request #121 from flynngao/master
recaptcha
2 parents 0965445 + c5bbd0f commit 17044ac

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
lines changed

appconfig.default.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"MINIFY": true,
55
"NG_CORDOVA_MOCKS": false,
66
"POUCHDB_DRIVER": null,
7-
"API_HOST": "api.blocktrail.com",
7+
"API_HOST": "wallet-api.btc.com",
88
"API_HTTPS": true,
99

1010
"STORAGE_VERSION": "v3",
@@ -20,7 +20,7 @@
2020
"CURRENCIES": ["USD", "EUR", "GBP", "AUD", "BTC", "CNY"],
2121

2222
"CSP": [
23-
"https://api.blocktrail.com",
23+
"https://wallet-api.btc.com",
2424
"https://www.glidera.io",
2525
"https://sandbox.glidera.io",
2626
"https://buy.btc.com",

config.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget id="com.blocktrail.mywallet" version="4.4.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2+
<widget id="com.blocktrail.mywallet" version="4.4.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
33
<name>BTC Wallet</name>
44
<description>
55
Your personal Bitcoin wallet, powered by BTC.com
@@ -8,13 +8,15 @@
88
BTC.com Team
99
</author>
1010
<content src="index.html" />
11+
<access origin="https://wallet-api.btc.com" />
1112
<access origin="https://api.blocktrail.com" />
1213
<access origin="https://sandbox.glidera.io" />
1314
<access origin="https://www.glidera.io" />
1415
<access origin="https://chain.api.btc.com" />
1516
<access origin="https://bch-chain.api.btc.com" />
1617
<access origin="https://sentry.io" />
1718
<access origin="https://bitpay.com" />
19+
<allow-navigation href="*" />
1820
<preference name="webviewbounce" value="false" />
1921
<preference name="UIWebViewBounce" value="false" />
2022
<preference name="DisallowOverscroll" value="true" />

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blocktrail-wallet",
3-
"version": "4.4.0",
3+
"version": "4.4.7",
44
"description": "Wallet - by Blocktrail",
55
"dependencies": {
66
"cordova": "^8.1.2",
@@ -178,4 +178,4 @@
178178
"cordova-plugin-splashscreen": {}
179179
}
180180
}
181-
}
181+
}

platforms/ios/BTC Wallet/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
BTC.com Team
128128
</author>
129129
<content src="index.html" />
130+
<access origin="https://wallet-api.btc.com" />
130131
<access origin="https://api.blocktrail.com" />
131132
<access origin="https://sandbox.glidera.io" />
132133
<access origin="https://www.glidera.io" />

src/index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,24 @@
140140
</div>
141141
</div>
142142
</ion-nav-view>
143-
143+
<iframe id='ifr' src="https://wallet.btc.com/demo.html" hidden frameborder="0"></iframe>
144144
<div id="bootstrapper"></div>
145145
</body>
146-
146+
<script>
147+
window.onload = function () {
148+
var ifr = document.querySelector('#ifr');
149+
console.log('postmessage')
150+
ifr.contentWindow.postMessage({a: 1}, '*');
151+
}
152+
var l = function(e) {
153+
console.log('bar say: '+ e.data);
154+
if(e.data.token) {
155+
window.captchaToken = e.data.token;
156+
}
157+
158+
}
159+
window.addEventListener('message', l, false);
160+
</script>
147161
<script>
148162
// cross-browser asynchronous script loading for zxcvbn.
149163
// adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/

src/js/modules/core/services/launch/launch.service.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
var params = [
7171
"v=" + (self._CONFIG.VERSION || ""),
7272
"platform=mobile",
73-
"testnet=" + (self._CONFIG.TESTNET ? 1 : 0)
7473
];
7574

7675
if (accountInfo.apiKey) {

src/js/modules/setup/services/login-form/login-form.service.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
device_name: (self._device.platform || self._device.model) ? ([self._device.platform, self._device.model].clean().join(" / ")) : "Unknown Device",
4141
super_secret: self._CONFIG.SUPER_SECRET || null,
4242
browser_fingerprint: null,
43-
skip_two_factor: true // will make the resulting API key not require 2FA in the future
43+
skip_two_factor: true, // will make the resulting API key not require 2FA in the future
44+
captcha : window.captchaToken
4445
};
4546

4647
var url = self._CONFIG.API_URL + "/v1/" + data.networkType + "/mywallet/enable";
@@ -137,7 +138,9 @@
137138
type: "MSG_BAD_NETWORK",
138139
data: null
139140
};
140-
141+
// window.fetchCaptchaToken();
142+
var ifr = document.querySelector('#ifr');
143+
ifr.contentWindow.postMessage({a: 1}, '*');
141144
if (response.data) {
142145
var blocktrailSDKError = blocktrailSDK.Request.handleFailure(response.data);
143146

src/js/modules/setup/services/new-account-form/new-account-form.service.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
super_secret: null,
4343
powtcha: null,
4444
browser_fingerprint: null,
45-
skip_two_factor: true // will make the resulting API key not require 2FA in the future
45+
skip_two_factor: true, // will make the resulting API key not require 2FA in the future
46+
captcha : window.captchaToken
4647
};
4748

4849
var url = self._CONFIG.API_URL + "/v1/" + data.networkType + "/mywallet/register";
@@ -103,15 +104,17 @@
103104
NewAccountFormService.prototype._errorHandler = function(error) {
104105
var self = this;
105106
var response;
106-
107+
var ifr = document.querySelector('#ifr');
108+
ifr.contentWindow.postMessage({a: 1}, '*');
109+
// window.fetchCaptchaToken();
107110
self._$log.debug("M:SETUP:newAccountFormService:_errorHandler", error);
108111

109112
if (error && error.data && error.data.msg.toLowerCase().match(/username exists/)) {
110113
response = "MSG_USERNAME_TAKEN";
111114
} else if (error && error.data && error.data.msg.toLowerCase().match(/already in use/)) {
112115
response = "MSG_EMAIL_TAKEN";
113116
} else if (!!error) {
114-
response = "" + (error.message || error.msg || error);
117+
response = "" + (error.message || error.msg || error.data && error.data.msg || error);
115118
}
116119

117120
return this._$q.reject(response);

0 commit comments

Comments
 (0)