diff --git a/www/js/controllers/login-controllers.js b/www/js/controllers/login-controllers.js
index 7145a319aaaad1d0685b66d029f1d1f39a1abb30..541c2deb47712a259375066312acd1a0316c588f 100644
--- a/www/js/controllers/login-controllers.js
+++ b/www/js/controllers/login-controllers.js
@@ -188,6 +188,7 @@ 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
@@ -195,7 +196,8 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
         promise = UIUtils.loading.show()
           .then(function() {
             return {
-              pubkey: pubkey
+              pubkey: pubkey,
+              uid : uid
             };
           });
       }
@@ -216,7 +218,8 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
             promise = UIUtils.loading.show()
               .then(function() {
                 return {
-                  pubkey: pubkey
+                  pubkey: pubkey,
+                  uid : uid
                 };
               });
           }
@@ -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
@@ -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) {
@@ -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);
         }
       });