Skip to content

Commit 0f5671a

Browse files
authored
Merge pull request #168 from blocktrail/develop
fix buy btc page and banned ip page.
2 parents 962d2b1 + 5548d32 commit 0f5671a

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

src/js/modules/setup/controllers/banned-ip/banned-ip.ctrl.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
function BannedIpCtrl($scope, CONFIG, $stateParams) {
99
$scope.CONFIG = CONFIG;
10-
$scope.bannedIp = $stateParams.bannedIp;
10+
var pattern = /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/;
11+
if (pattern.test($stateParams.bannedIp)) {
12+
$scope.bannedIp = $stateParams.bannedIp;
13+
} else {
14+
$scope.bannedIp = '';
15+
}
1116
}
1217

1318
})();

src/js/modules/wallet/controllers/buy-btc-broker/buy-btc-broker.ctrl.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
$stateParams, $q, $timeout, $interval, $translate, $filter, trackingService, NotificationsService) {
1010
var walletData = activeWallet.getReadOnlyWalletData();
1111

12+
$scope.network = CONFIG.NETWORKS[walletData.networkType].TICKER;
1213
$scope.networkLong = CONFIG.NETWORKS[walletData.networkType.replace("t", "")].NETWORK_LONG;
13-
$rootScope.pageTitle = $translate.instant("BUYBTC_NETWORK", { network: $scope.networkLong });
14+
$rootScope.pageTitle = $translate.instant("BUYBTC_NETWORK", { network: $scope.network });
1415

1516
$scope.broker = $stateParams.broker;
1617
$scope.brokerNotExistent = false;
@@ -19,6 +20,7 @@
1920
$scope.fetchingMainPrice = true;
2021
$scope.priceBTC = null;
2122
$scope.fetchingInputPrice = false;
23+
$scope.amount = null;
2224
$scope.fiatFirst = false;
2325
$scope.buyInput = {
2426
currencyType: null,
@@ -126,7 +128,16 @@
126128
return null;
127129
}
128130

129-
return fetchBrokerService().buyPrices(1, null, $scope.buyInput.fiatCurrency, false, true).then(function(result) {
131+
switch ($scope.network) {
132+
case "BTC":
133+
$scope.amount = 0.1;
134+
break;
135+
case "BCH":
136+
$scope.amount = 1;
137+
break;
138+
}
139+
140+
return fetchBrokerService().buyPrices($scope.amount, null, $scope.buyInput.fiatCurrency, false, true).then(function(result) {
130141
$scope.priceBTC = result.total;
131142
$scope.fetchingMainPrice = false;
132143
}).catch(function (e) {

src/js/modules/wallet/controllers/buy-btc-broker/buy-btc-broker.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h2 class="broker-title">
3030
<loading-spinner></loading-spinner>
3131
</div>
3232
<div ng-if="!fetchingMainPrice" class="currentprice-value">
33-
<b>{{ buyInput.fiatCurrency | toCurrencySymbol }}{{ priceBTC | number:2 }}</b>
33+
<b>{{ buyInput.fiatCurrency | toCurrencySymbol }}{{ priceBTC | number:2 }} / {{ amount }} {{ network }}</b>
3434
</div>
3535
</div>
3636
</div>

src/js/modules/wallet/controllers/buy-btc-choose/buy-btc-choose.ctrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
});
2828
});
2929

30-
$rootScope.pageTitle = $translate.instant("BUYBTC_NETWORK", { network: $scope.networkLong });
30+
$rootScope.pageTitle = $translate.instant("BUYBTC_NETWORK", { network: $scope.network });
3131

3232
$scope.goBuyBTCState = function(broker) {
3333
$state.go("app.wallet.buybtc.buy", {broker: broker});

src/sass/theme/reset.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ $display-token-size: 50px;
15901590
}
15911591

15921592
.currentprice-value {
1593-
font-size: 30px;
1593+
font-size: 20px;
15941594
}
15951595

15961596
.currentprice-label {

0 commit comments

Comments
 (0)