Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
[FIX] Resend email without unlock (RT-3104)
Browse files Browse the repository at this point in the history
Sign-up: resend email without requiring unlock
  • Loading branch information
darkdarkdragon committed Feb 17, 2015
1 parent 222f3c6 commit 548942a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
7 changes: 7 additions & 0 deletions src/js/services/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,13 @@ module.factory('rpId', ['$rootScope', '$location', '$route', '$routeParams', '$t

if (!emailVerified) {
$scope.unverified = true;
// get secret to allow email re-send without unlocking
$authflow.unlock(Id.normalizeUsernameForInternals(username), password, function(err, resp) {
if (!err && resp) {
$scope.keyOpen = resp.secret;
}
});

$location.path('/register');

callback(new Error("Email has not been verified!"));
Expand Down
57 changes: 32 additions & 25 deletions src/js/tabs/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,39 +137,46 @@ RegisterTab.prototype.angular = function (module) {
});
};

var _resnedEmail = function(masterkey) {
id.resendEmail({
id:$scope.userBlob.id,
url:$scope.userBlob.url,
username: $scope.userCredentials.username,
account_id: $scope.userBlob.data.account_id,
email: $scope.newEmail || $scope.userBlob.data.email,
masterkey: masterkey
}, function(err, response){
if (err) {
console.log('Error', err);
return;
}

// Update the blob
$scope.userBlob.set('/email', $scope.newEmail || $scope.userBlob.data.email);

$scope.resendLoading = false;
$scope.resendSuccess = true;
});
}

$scope.resendEmail = function()
{
$scope.resendLoading = true;

keychain.requestSecret(id.account, id.username,
function (err, masterkey) {
if (err) {
console.log('client: register tab: error while ' +
'unlocking wallet: ', err);
$scope.mode = 'verification';
return;
}

id.resendEmail({
id:$scope.userBlob.id,
url:$scope.userBlob.url,
username: $scope.userCredentials.username,
account_id: $scope.userBlob.data.account_id,
email: $scope.newEmail || $scope.userBlob.data.email,
masterkey: masterkey
}, function(err, response){
if ($scope.keyOpen) {
_resnedEmail($scope.keyOpen);
} else {
keychain.requestSecret(id.account, id.username,
function (err, masterkey) {
if (err) {
console.log('Error', err);
console.log('client: register tab: error while ' +
'unlocking wallet: ', err);
$scope.mode = 'verification';
return;
}

// Update the blob
$scope.userBlob.set('/email', $scope.newEmail || $scope.userBlob.data.email);

$scope.resendLoading = false;
$scope.resendSuccess = true;
_resnedEmail(masterkey);
});
});
}
};

var updateFormFields = function() {
Expand Down

0 comments on commit 548942a

Please sign in to comment.