Skip to content

Commit

Permalink
[enh] Login: when login by pubkey, after a lookup search, use the sel…
Browse files Browse the repository at this point in the history
…ect 'uid'
  • Loading branch information
blavenie committed Nov 5, 2018
1 parent a787ca6 commit 8a59a2e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions www/js/controllers/login-controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,16 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
// Pubkey
else if (method === 'PUBKEY') {
var pubkey = $scope.formData.pubkey && $scope.formData.pubkey.trim();
var uid = $scope.formData.uid && $scope.formData.uid.trim() || undefined;
if (!pubkey) return;
var matches = BMA.regexp.PUBKEY.exec(pubkey);
// valid pubkey: use it
if (matches) {
promise = UIUtils.loading.show()
.then(function() {
return {
pubkey: pubkey
pubkey: pubkey,
uid : uid
};
});
}
Expand All @@ -216,7 +218,8 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
promise = UIUtils.loading.show()
.then(function() {
return {
pubkey: pubkey
pubkey: pubkey,
uid : uid
};
});
}
Expand Down Expand Up @@ -415,6 +418,7 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,

console.debug("[login] method is: " + method);
$scope.formData.method = method;
$scope.formData.uid = null;

if ($scope.form) {
// hide form's fields errors on the form
Expand All @@ -425,6 +429,7 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
if (method == 'SCRYPT_DEFAULT' || method == 'SCRYPT_ADVANCED') {
$scope.pubkey = null;


// Search scrypt object
var scrypt;
if (params) {
Expand Down Expand Up @@ -580,6 +585,7 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
.then(function(res){
if (res && res.pubkey) {
$scope.formData.pubkey = res.pubkey;
$scope.formData.uid = res.uid || undefined;
return $timeout($scope.doLogin, 300);
}
});
Expand Down

0 comments on commit 8a59a2e

Please sign in to comment.