mirror of https://github.com/BTCPrivate/copay.git
fixes notification for invalid credentials
This commit is contained in:
parent
ad45eca130
commit
b08ccb6111
|
@ -10,6 +10,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
identityService.open($scope, form);
|
identityService.open($scope, form);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -259,8 +259,8 @@ Identity.prototype.close = function(cb) {
|
||||||
* @param {string} cypherText - the encrypted object
|
* @param {string} cypherText - the encrypted object
|
||||||
* @param {string} passphrase - passphrase to decrypt it
|
* @param {string} passphrase - passphrase to decrypt it
|
||||||
* @param {string[]} opts.skipFields - fields to ignore when importing
|
* @param {string[]} opts.skipFields - fields to ignore when importing
|
||||||
* @param {string[]} opts.salt -
|
* @param {string[]} opts.salt -
|
||||||
* @param {string[]} opts.iterations -
|
* @param {string[]} opts.iterations -
|
||||||
* @param {string[]} opts.importFunction - for stubbing
|
* @param {string[]} opts.importFunction - for stubbing
|
||||||
* @return {Wallet}
|
* @return {Wallet}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,7 +13,7 @@ EncryptedInsightStorage.prototype.getItem = function(name, callback) {
|
||||||
function(err, body) {
|
function(err, body) {
|
||||||
var decryptedJson = cryptoUtil.decrypt(key, body);
|
var decryptedJson = cryptoUtil.decrypt(key, body);
|
||||||
if (!decryptedJson) {
|
if (!decryptedJson) {
|
||||||
return callback('Internal Error');
|
return callback('PNOTFOUND');
|
||||||
}
|
}
|
||||||
return callback(null, decryptedJson);
|
return callback(null, decryptedJson);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,15 @@ inherits(EncryptedLocalStorage, LocalStorage);
|
||||||
|
|
||||||
EncryptedLocalStorage.prototype.getItem = function(name, callback) {
|
EncryptedLocalStorage.prototype.getItem = function(name, callback) {
|
||||||
var key = cryptoUtil.kdf(this.password + this.email);
|
var key = cryptoUtil.kdf(this.password + this.email);
|
||||||
LocalStorage.prototype.getItem.apply(this, [name, function(err, body) {
|
LocalStorage.prototype.getItem.apply(this, [name,
|
||||||
var decryptedJson = cryptoUtil.decrypt(key, body);
|
function(err, body) {
|
||||||
if (!decryptedJson) {
|
var decryptedJson = cryptoUtil.decrypt(key, body);
|
||||||
return callback('Internal Error');
|
if (!decryptedJson) {
|
||||||
|
return callback('PNOTFOUND');
|
||||||
|
}
|
||||||
|
return callback(null, decryptedJson);
|
||||||
}
|
}
|
||||||
return callback(null, decryptedJson);
|
]);
|
||||||
}]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EncryptedLocalStorage.prototype.setItem = function(name, value, callback) {
|
EncryptedLocalStorage.prototype.setItem = function(name, value, callback) {
|
||||||
|
|
|
@ -25,7 +25,6 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
iden.createWallet(walletOptions, function(err, wallet) {
|
iden.createWallet(walletOptions, function(err, wallet) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('Error:' + err)
|
|
||||||
controllerUtils.onErrorDigest(
|
controllerUtils.onErrorDigest(
|
||||||
scope, 'Could not create default wallet');
|
scope, 'Could not create default wallet');
|
||||||
} else {
|
} else {
|
||||||
|
@ -47,9 +46,8 @@ angular.module('copayApp.services')
|
||||||
passphraseConfig: config.passphraseConfig,
|
passphraseConfig: config.passphraseConfig,
|
||||||
}, function(err, iden) {
|
}, function(err, iden) {
|
||||||
if (err && !iden) {
|
if (err && !iden) {
|
||||||
console.log('Error:' + err)
|
|
||||||
controllerUtils.onErrorDigest(
|
controllerUtils.onErrorDigest(
|
||||||
scope, (err.toString() || '').match('PNOTFOUND') ? 'Profile not found' : 'Unknown error');
|
scope, (err.toString() || '').match('PNOTFOUND') ? 'Invalid email or password' : 'Unknown error');
|
||||||
} else {
|
} else {
|
||||||
var firstWallet = iden.getLastFocusedWallet();
|
var firstWallet = iden.getLastFocusedWallet();
|
||||||
controllerUtils.bindProfile(scope, iden, firstWallet);
|
controllerUtils.bindProfile(scope, iden, firstWallet);
|
||||||
|
|
|
@ -185,6 +185,7 @@ factory('notification', ['$timeout',
|
||||||
'timestamp': +new Date(),
|
'timestamp': +new Date(),
|
||||||
'userData': userData
|
'userData': userData
|
||||||
};
|
};
|
||||||
|
|
||||||
notifications.push(notification);
|
notifications.push(notification);
|
||||||
|
|
||||||
if (settings.html5Mode) {
|
if (settings.html5Mode) {
|
||||||
|
@ -193,7 +194,10 @@ factory('notification', ['$timeout',
|
||||||
}, function() {
|
}, function() {
|
||||||
// inner on close function
|
// inner on close function
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
//this is done because html5Notify() changes the variable settings.html5Mode
|
||||||
|
if (!settings.html5Mode) {
|
||||||
queue.push(notification);
|
queue.push(notification);
|
||||||
$timeout(function removeFromQueueTimeout() {
|
$timeout(function removeFromQueueTimeout() {
|
||||||
queue.splice(queue.indexOf(notification), 1);
|
queue.splice(queue.indexOf(notification), 1);
|
||||||
|
@ -202,11 +206,14 @@ factory('notification', ['$timeout',
|
||||||
|
|
||||||
// Mobile notification
|
// Mobile notification
|
||||||
if (window && window.navigator && window.navigator.vibrate) {
|
if (window && window.navigator && window.navigator.vibrate) {
|
||||||
window.navigator.vibrate([200,100,200]);
|
window.navigator.vibrate([200, 100, 200]);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (document.hidden && (type == 'info' || type == 'funds')) {
|
if (document.hidden && (type == 'info' || type == 'funds')) {
|
||||||
new window.Notification(title, {body: content, icon:'img/notification.png'});
|
new window.Notification(title, {
|
||||||
|
body: content,
|
||||||
|
icon: 'img/notification.png'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.save();
|
this.save();
|
||||||
|
@ -234,8 +241,7 @@ factory('notification', ['$timeout',
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]).
|
]).directive('notifications', function(notification, $compile) {
|
||||||
directive('notifications', function(notification, $compile) {
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* It should also parse the arguments passed to it that specify
|
* It should also parse the arguments passed to it that specify
|
||||||
|
|
Loading…
Reference in New Issue