Commit 71fbd200 authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Login using file + drag&drop failed - Fix #696

parent b39973e4
......@@ -337,9 +337,10 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils,
$scope.formData.file = {
name: file.fileData.name,
size: file.fileData.size
size: file.fileData.size,
content: file.fileContent
};
return CryptoUtils.parseKeyFileContent(file.fileContent, false/*withSecret*/)
return CryptoUtils.readKeyFile($scope.formData.file, false/*withSecret*/)
.then(function(keypair) {
if (!keypair || !keypair.signPk) {
$scope.formData.file.valid = false;
......
......@@ -141,6 +141,11 @@ angular.module('cesium.crypto.services', ['cesium.utils.services'])
CryptoAbstractService.prototype.readKeyFile = function(file, withSecret) {
var that = this;
if (file && file.content) {
return that.parseKeyFileContent(file.content, withSecret);
}
return $q(function(resolve, reject) {
if (!file) {
return reject('Argument [file] is missing');
......@@ -149,8 +154,7 @@ angular.module('cesium.crypto.services', ['cesium.utils.services'])
console.debug('[crypto] [keypair] reading file: ', file);
var reader = new FileReader();
reader.onload = function (event) {
var res = that.parseKeyFileContent(event.target.result, withSecret);
res
that.parseKeyFileContent(event.target.result, withSecret)
.then(function (res) {
resolve(res);
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment