mirror of https://github.com/BTCPrivate/copay.git
methods to resend email from identity
This commit is contained in:
parent
173e5f2b12
commit
b0c31b37c3
|
@ -5,8 +5,8 @@ angular.module('copayApp.controllers').controller('IndexController', function($s
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.resendVerificationEmail = function (cb) {
|
$scope.resendVerificationEmail = function () {
|
||||||
identityService.resendVerificationEmail(cb);
|
identityService.resendVerificationEmail(function () {});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.swipe = function(invert) {
|
$scope.swipe = function(invert) {
|
||||||
|
|
|
@ -105,6 +105,15 @@ Identity.create = function(opts, cb) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Identity.prototype.resendVerificationEmail = function (cb) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
preconditions.checkArgument(_.isFunction(cb));
|
||||||
|
preconditions.checkState(_.isFunction(self.storage.resendVerificationEmail));
|
||||||
|
|
||||||
|
self.storage.resendVerificationEmail(cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open an Identity from the given storage.
|
* Open an Identity from the given storage.
|
||||||
|
|
|
@ -16,6 +16,10 @@ EncryptedInsightStorage.prototype._brokenDecrypt = function(body) {
|
||||||
return decryptedJson;
|
return decryptedJson;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EncryptedInsightStorage.prototype.resendVerificationEmail = function(callback) {
|
||||||
|
InsightStorage.prototype.resendVerificationEmail.apply(this, [callback]);
|
||||||
|
};
|
||||||
|
|
||||||
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
|
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
InsightStorage.prototype.getItem.apply(this, [name,
|
InsightStorage.prototype.getItem.apply(this, [name,
|
||||||
|
|
|
@ -37,6 +37,31 @@ InsightStorage.prototype.createItem = function(name, value, callback) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
InsightStorage.prototype.resendVerificationEmail = function (callback) {
|
||||||
|
var passphrase = this.getPassphrase();
|
||||||
|
var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64');
|
||||||
|
var resendUrl = this.storeUrl + '/resend_email';
|
||||||
|
|
||||||
|
log.debug('Resending verification email: ' + this.email);
|
||||||
|
this.request.get({
|
||||||
|
url: resendUrl,
|
||||||
|
headers: {
|
||||||
|
'Authorization': authHeader
|
||||||
|
},
|
||||||
|
body: null,
|
||||||
|
}, function(err, response, body) {
|
||||||
|
if (err) {
|
||||||
|
return callback('Connection error');
|
||||||
|
}
|
||||||
|
if (response.statusCode === 409) {
|
||||||
|
return callback('BADCREDENTIALS: Invalid username or password');
|
||||||
|
} else if (response.statusCode !== 200) {
|
||||||
|
return callback('Unable to process the request');
|
||||||
|
}
|
||||||
|
return callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function mayBeOldPassword(password) {
|
function mayBeOldPassword(password) {
|
||||||
// Test for base64
|
// Test for base64
|
||||||
return /^[a-zA-Z0-9\/=\+]+$/.test(password);
|
return /^[a-zA-Z0-9\/=\+]+$/.test(password);
|
||||||
|
|
|
@ -63,7 +63,8 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.resendVerificationEmail = function (cb) {
|
root.resendVerificationEmail = function (cb) {
|
||||||
console.log('yes');
|
var iden = $rootScope.iden;
|
||||||
|
iden.resendVerificationEmail(cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setServerStatus = function(headers) {
|
root.setServerStatus = function(headers) {
|
||||||
|
|
Loading…
Reference in New Issue