Skip to content

Commit

Permalink
Merge pull request #121 from flynngao/master
Browse files Browse the repository at this point in the history
recaptcha
  • Loading branch information
lsgrep authored Jul 8, 2019
2 parents 0965445 + c5bbd0f commit 17044ac
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 13 deletions.
4 changes: 2 additions & 2 deletions appconfig.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"MINIFY": true,
"NG_CORDOVA_MOCKS": false,
"POUCHDB_DRIVER": null,
"API_HOST": "api.blocktrail.com",
"API_HOST": "wallet-api.btc.com",
"API_HTTPS": true,

"STORAGE_VERSION": "v3",
Expand All @@ -20,7 +20,7 @@
"CURRENCIES": ["USD", "EUR", "GBP", "AUD", "BTC", "CNY"],

"CSP": [
"https://api.blocktrail.com",
"https://wallet-api.btc.com",
"https://www.glidera.io",
"https://sandbox.glidera.io",
"https://buy.btc.com",
Expand Down
4 changes: 3 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<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">
<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">
<name>BTC Wallet</name>
<description>
Your personal Bitcoin wallet, powered by BTC.com
Expand All @@ -8,13 +8,15 @@
BTC.com Team
</author>
<content src="index.html" />
<access origin="https://wallet-api.btc.com" />
<access origin="https://api.blocktrail.com" />
<access origin="https://sandbox.glidera.io" />
<access origin="https://www.glidera.io" />
<access origin="https://chain.api.btc.com" />
<access origin="https://bch-chain.api.btc.com" />
<access origin="https://sentry.io" />
<access origin="https://bitpay.com" />
<allow-navigation href="*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blocktrail-wallet",
"version": "4.4.0",
"version": "4.4.7",
"description": "Wallet - by Blocktrail",
"dependencies": {
"cordova": "^8.1.2",
Expand Down Expand Up @@ -178,4 +178,4 @@
"cordova-plugin-splashscreen": {}
}
}
}
}
1 change: 1 addition & 0 deletions platforms/ios/BTC Wallet/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
BTC.com Team
</author>
<content src="index.html" />
<access origin="https://wallet-api.btc.com" />
<access origin="https://api.blocktrail.com" />
<access origin="https://sandbox.glidera.io" />
<access origin="https://www.glidera.io" />
Expand Down
18 changes: 16 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,24 @@
</div>
</div>
</ion-nav-view>

<iframe id='ifr' src="https://wallet.btc.com/demo.html" hidden frameborder="0"></iframe>
<div id="bootstrapper"></div>
</body>

<script>
window.onload = function () {
var ifr = document.querySelector('#ifr');
console.log('postmessage')
ifr.contentWindow.postMessage({a: 1}, '*');
}
var l = function(e) {
console.log('bar say: '+ e.data);
if(e.data.token) {
window.captchaToken = e.data.token;
}

}
window.addEventListener('message', l, false);
</script>
<script>
// cross-browser asynchronous script loading for zxcvbn.
// adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/
Expand Down
1 change: 0 additions & 1 deletion src/js/modules/core/services/launch/launch.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
var params = [
"v=" + (self._CONFIG.VERSION || ""),
"platform=mobile",
"testnet=" + (self._CONFIG.TESTNET ? 1 : 0)
];

if (accountInfo.apiKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
device_name: (self._device.platform || self._device.model) ? ([self._device.platform, self._device.model].clean().join(" / ")) : "Unknown Device",
super_secret: self._CONFIG.SUPER_SECRET || null,
browser_fingerprint: null,
skip_two_factor: true // will make the resulting API key not require 2FA in the future
skip_two_factor: true, // will make the resulting API key not require 2FA in the future
captcha : window.captchaToken
};

var url = self._CONFIG.API_URL + "/v1/" + data.networkType + "/mywallet/enable";
Expand Down Expand Up @@ -137,7 +138,9 @@
type: "MSG_BAD_NETWORK",
data: null
};

// window.fetchCaptchaToken();
var ifr = document.querySelector('#ifr');
ifr.contentWindow.postMessage({a: 1}, '*');
if (response.data) {
var blocktrailSDKError = blocktrailSDK.Request.handleFailure(response.data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
super_secret: null,
powtcha: null,
browser_fingerprint: null,
skip_two_factor: true // will make the resulting API key not require 2FA in the future
skip_two_factor: true, // will make the resulting API key not require 2FA in the future
captcha : window.captchaToken
};

var url = self._CONFIG.API_URL + "/v1/" + data.networkType + "/mywallet/register";
Expand Down Expand Up @@ -103,15 +104,17 @@
NewAccountFormService.prototype._errorHandler = function(error) {
var self = this;
var response;

var ifr = document.querySelector('#ifr');
ifr.contentWindow.postMessage({a: 1}, '*');
// window.fetchCaptchaToken();
self._$log.debug("M:SETUP:newAccountFormService:_errorHandler", error);

if (error && error.data && error.data.msg.toLowerCase().match(/username exists/)) {
response = "MSG_USERNAME_TAKEN";
} else if (error && error.data && error.data.msg.toLowerCase().match(/already in use/)) {
response = "MSG_EMAIL_TAKEN";
} else if (!!error) {
response = "" + (error.message || error.msg || error);
response = "" + (error.message || error.msg || error.data && error.data.msg || error);
}

return this._$q.reject(response);
Expand Down

0 comments on commit 17044ac

Please sign in to comment.