@@ -564,7 +563,8 @@
not valid
@@ -604,7 +604,9 @@
{{notEnoughAmount}}
-
+
BTC
diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js
index b97659d89..ede169280 100644
--- a/js/controllers/transactions.js
+++ b/js/controllers/transactions.js
@@ -1,7 +1,7 @@
'use strict';
angular.module('copay.transactions').controller('TransactionsController',
- function($scope, $rootScope, controllerUtils) {
+ function($scope, $rootScope, $timeout, controllerUtils) {
$scope.title = 'Transactions';
$scope.loading = false;
@@ -31,21 +31,21 @@ angular.module('copay.transactions').controller('TransactionsController',
};
$scope.toogleLast = function () {
- console.log('[toogleLast]');
- $scope.loading=true;
+ $scope.loading = true;
$scope.lastShowed = !$scope.lastShowed;
if ($scope.lastShowed) {
$scope.getTransactions(function(txs){
- $scope.loading=false;
- $scope.blockchain_txs = txs;
- $rootScope.$digest();
+ $timeout(function() {
+ $scope.loading = false;
+ $scope.blockchain_txs = txs;
+ $scope.$digest();
+ }, 10);
});
- }
- else {
- setTimeout(function(){
- $scope.loading=false;
+ } else {
+ $timeout(function(){
+ $scope.loading = false;
$rootScope.$digest();
- });
+ }, 10);
}
};
@@ -90,7 +90,6 @@ angular.module('copay.transactions').controller('TransactionsController',
$scope.getTransactions = function(cb) {
var w =$rootScope.wallet;
if (w) {
-
console.log('### Querying last transactions...'); //TODO
var addresses = w.getAddressesStr();
if (addresses.length > 0) {
diff --git a/js/directives.js b/js/directives.js
index 606c5e9c9..822fdae85 100644
--- a/js/directives.js
+++ b/js/directives.js
@@ -105,7 +105,8 @@ angular.module('copay.directives')
});
}
}
- }).directive('avatar', function($rootScope, controllerUtils) {
+ })
+ .directive('avatar', function($rootScope, controllerUtils) {
return {
link: function(scope, element, attrs) {
var peer = JSON.parse(attrs.peer)
@@ -118,4 +119,75 @@ angular.module('copay.directives')
}
}
}
+ })
+ .directive('checkStrength', function() {
+ return {
+ replace: false,
+ restrict: 'EACM',
+ scope: { model: '=checkStrength' },
+ link: function(scope, element, attrs) {
+ var _grep = function(elems, callback, invert) {
+ var callbackInverse,
+ matches = [],
+ i = 0,
+ length = elems.length,
+ callbackExpect = !invert;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for (; i < length; i++) {
+ callbackInverse = !callback(elems[i], i);
+ if (callbackInverse !== callbackExpect) {
+ matches.push(elems[i]);
+ }
+ }
+
+ return matches;
+ };
+
+ var strength = {
+ colors: ['#c0392b', '#e74c3c', '#d35400', '#f39c12', '#27ae60'],
+ mesureStrength: function (p) {
+ var _force = 0;
+ var _regex = /[$-/:-?{-~!"^_`\[\]]/g;
+ var _lowerLetters = /[a-z]+/.test(p);
+ var _upperLetters = /[A-Z]+/.test(p);
+ var _numbers = /[0-9]+/.test(p);
+ var _symbols = _regex.test(p);
+ var _flags = [_lowerLetters, _upperLetters, _numbers, _symbols];
+ var _passedMatches = _grep(_flags, function (el) { return el === true; }).length;
+
+ _force += 2 * p.length + ((p.length >= 10) ? 1 : 0);
+ _force += _passedMatches * 10;
+
+ // penality (short password)
+ _force = (p.length <= 6) ? Math.min(_force, 10) : _force;
+
+ // penality (poor variety of characters)
+ _force = (_passedMatches == 1) ? Math.min(_force, 10) : _force;
+ _force = (_passedMatches == 2) ? Math.min(_force, 20) : _force;
+ _force = (_passedMatches == 3) ? Math.min(_force, 40) : _force;
+ return _force;
+ },
+ getColor: function (s) {
+ var idx = 0;
+
+ if (s <= 10) { idx = 0; }
+ else if (s <= 20) { idx = 1; }
+ else if (s <= 30) { idx = 2; }
+ else if (s <= 40) { idx = 3; }
+ else { idx = 4; }
+
+ return { idx: idx + 1, col: this.colors[idx] };
+ }
+ };
+
+ scope.$watch('model', function (newValue, oldValue) {
+ if (newValue && newValue !== '') {
+ var c = strength.getColor(strength.mesureStrength(newValue));
+ element.css({ 'border-color': c.col })
+ }
+ });
+ }
+ };
});
diff --git a/js/filters.js b/js/filters.js
index 258d22610..5954ea5d1 100644
--- a/js/filters.js
+++ b/js/filters.js
@@ -14,15 +14,22 @@ angular.module('copay.filters', [])
return dic;
}
- var dic = inputs.reduce(reduce, {});
- return Object.keys(dic).map(function(key) {
- return { addr: key, value: dic[key] };
- });
+ var dic;
+ if (inputs) {
+ dic = inputs.reduce(reduce, {});
+ return Object.keys(dic).map(function(key) {
+ return { addr: key, value: dic[key] };
+ });
+ }
};
})
.filter('paged', function() {
return function(elements) {
- return elements.filter(Boolean);
+ if (elements) {
+ return elements.filter(Boolean);
+ }
+
+ return false;
};
})
.filter('limitAddress', function() {
diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js
index 55bc54305..f221378ad 100644
--- a/js/models/core/Wallet.js
+++ b/js/models/core/Wallet.js
@@ -77,19 +77,18 @@ console.log('[Wallet.js.58] connecting'); //TODO
Wallet.prototype._handlePublicKeyRing = function(senderId, data, isInbound) {
this.log('RECV PUBLICKEYRING:', data);
- var recipients, pkr = this.publicKeyRing;
var inPKR = copay.PublicKeyRing.fromObj(data.publicKeyRing);
+ var wasIncomplete = !this.publicKeyRing.isComplete();
+ var hasChanged = this.publicKeyRing.merge(inPKR, true);
- var hasChanged = pkr.merge(inPKR, true);
if (hasChanged) {
- this.connectToAll();
+ if (wasIncomplete) {
+ this.sendPublicKeyRing();
+ this.connectToAll();
+ }
if (this.publicKeyRing.isComplete()) {
this._lockIncomming();
}
- this.log('### BROADCASTING PKR');
-
- recipients = null;
- this.sendPublicKeyRing(recipients);
}
this.emit('publicKeyRingUpdated');
this.store();
diff --git a/launch.js b/launch.js
new file mode 100755
index 000000000..aaf071b2e
--- /dev/null
+++ b/launch.js
@@ -0,0 +1,32 @@
+#! /usr/bin/node
+
+'use strict';
+
+
+
+var sys = require('sys')
+var exec = require('child_process').exec;
+function puts(error, stdout, stderr) { sys.puts(stdout) }
+
+function isNumber(n) {
+ return !isNaN(parseInt(n)) && isFinite(n);
+}
+
+var args = process.argv.slice(2);
+var n_str = args[0];
+if (!isNumber(n_str)) {
+ console.log('Program requires one numeric argument for the amount of copayers');
+ process.exit(1);
+}
+
+var N = parseInt(n_str);
+var DEFAULT_PORT = process.env.DEFAULT_PORT || 3000;
+
+
+for (var i=0; i