function LoginControllerUUID($scope, $http, $location, $modalInstance, userService, uuid) {
  $scope.login = {
    uuid: uuid
  }

  Login($scope, $http, $location, $modalInstance, userService);
}

function LoginController($scope, $http, $location, $modalInstance, userService) {
  Login($scope, $http, $location, $modalInstance, userService);
}

// Helper (Not sure if this can be fixed with providers)
function Login($scope, $http, $location, $modalInstance, userService) {
  $scope.open = function(login) {
    var postData = {
      type: 'RESTOREWALLET',
      uuid: login.uuid
    }
    $http({
        url: '/v1/user/wallet/restore/',
        method: 'POST',
        data: postData,
        headers: {'Content-Type': 'application/json'}
    })
    .success(function (data, status, headers, config) {
      console.log(data);
      if(data.status == "MISSING") {
        $scope.missingUUID = true;
      } else {
        var passwordHash = data.wallet.passwordHash;
        var salt = data.wallet.salt;
        var loginHash = Crypto.SHA256(login.password + salt);

        if(loginHash == passwordHash) {
          console.log(data.wallet);
          userService.login(data.wallet);
          $modalInstance.close();
          $location.path('/wallet');
        } else {
          $scope.badPassword = true;
        }
      }
    })
    .error(function(data, status, headers, config) {
      $scope.serverError = true;
    });
  }
}

@@ -515,61 +515,14 @@
 var 
-postData = %7B%0A      type: 'RESTOREWALLET',%0A      
 uuid
-:
+ =
  log
@@ -532,115 +532,164 @@
 uuid
+;
 %0A    
-%7D%0A    $http(%7B%0A        url: '/v1/user/wallet/restore/',%0A        method: 'POST',%0A        data: postData,
+var asymKey = %7B%7D;%0A    var walletKey = '';%0A%0A    $http.get('/flask/challenge?uuid='+uuid)%0A      .then(function(result) %7B%0A        var data = result.data;
 %0A   
@@ -697,381 +697,549 @@
     
-headers: %7B'Content-Type': 'application/json'%7D
+var nonce = CryptUtil.generateNonceForDifficulty(data.pow_challenge);
 %0A    
-%7D)%0A
     
-.success(function (data, status, headers, config) %7B%0A      console.log(data);%0A      if(data.status == %22MISSING%22) %7B%0A        $scope.missingUUID = true;%0A      %7D else %7B%0A        var passwordHash = data.wallet.passwordHash;%0A        var salt = data.wallet.salt;%0A        var loginHash = Crypto.SHA256(login.password + sa
+walletKey = CryptUtil.generateSymmetricKey(login.password, data.salt);%0A        asymKey = CryptUtil.generateAsymmetricPair();%0A%0A        return $http(%7B%0A          url: '/flask/login',%0A          method: 'GET',%0A          params: %7B nonce: nonce, public_key: asymKey.pubPem, uuid: uuid %7D%0A        %7D);%0A      %7D, function (result) %7B%0A        console.log('error getting salt');%0A      %7D)%0A      .then(function(result) %7B%0A        var data = result.data;%0A        console.log(resu
 lt)
-;%0A
 %0A   
@@ -1247,73 +1247,88 @@
     
-if(loginHash == passwordHash) %7B%0A          console.log
+console.log(data);%0A%0A        var wallet = CryptUtil.decryptObject
 (data
-.
+, 
 wallet
+Key
 );%0A 
@@ -1334,18 +1334,16 @@
         
-  
 userServ
@@ -1356,19 +1356,34 @@
 gin(
-data.
 wallet
+, walletKey, asymKey
 );%0A 
@@ -1389,18 +1389,16 @@
         
-  
 $modalIn
@@ -1411,20 +1411,17 @@
 .close()
-;%0A  
+%0A
         
@@ -1457,134 +1457,32 @@
     
-  %7D else %7B%0A          $scope.badPassword = true;%0A        %7D%0A      %7D%0A    %7D)%0A    .error(function(data, status, headers, config
+%7D, function(result
 ) %7B%0A
+  
     
@@ -1510,16 +1510,18 @@
 = true;%0A
+  
     %7D);%0A

Update Login controller to new login scheme