diff --git a/src/manifest.json b/src/manifest.json
index e2ac4fa26d..59315fe6e6 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -19,6 +19,8 @@
"node_modules/sjcl/core/bitArray.js",
"models/api/requestModels.js",
"models/api/responseModels.js",
+ "models/dataModels.js",
+ "models/domainModels.js",
"services/cryptoService.js",
"services/cryptoService.js",
"services/tokenService.js",
diff --git a/src/models/domainModels.js b/src/models/domainModels.js
index 992cde9164..7699bb5294 100644
--- a/src/models/domainModels.js
+++ b/src/models/domainModels.js
@@ -13,7 +13,7 @@ var CipherString = function (encryptedString) {
CipherString.prototype.decrypt = function (callback) {
if (!_decryptedValue) {
var cryptoService = chrome.extension.getBackgroundPage().cryptoService;
- _decryptedValue = cryptoService.Decrypt(this);
+ _decryptedValue = cryptoService.decrypt(this);
}
return _decryptedValue;
@@ -39,7 +39,7 @@ var Site = function (obj, alreadyEncrypted) {
this.notes = new CipherString(obj.notes);
}
- this.favorite = new obj.favorite;
+ this.favorite = obj.favorite ? true : false;
};
var Folder = function (obj, alreadyEncrypted) {
diff --git a/src/popup/app/services/loginService.js b/src/popup/app/services/loginService.js
index 79feb30358..1c403b9911 100644
--- a/src/popup/app/services/loginService.js
+++ b/src/popup/app/services/loginService.js
@@ -1,15 +1,15 @@
angular
.module('bit.services')
- .factory('loginService', function (cryptoService, apiService, apiService, userService, tokenService, $q) {
+ .factory('loginService', function (cryptoService, apiService, userService, tokenService, $q) {
var _service = {};
_service.logIn = function (email, masterPassword) {
var key = cryptoService.makeKey(masterPassword, email);
+ var deferred = $q.defer();
cryptoService.hashPassword(masterPassword, key, function (hashedPassword) {
var request = new TokenRequest(email, hashedPassword);
- var deferred = $q.defer();
apiService.postToken(request, function (response) {
if (!response || !response.token) {
return;
@@ -25,9 +25,8 @@
}, function (error) {
deferred.reject(error);
});
-
- return deferred.promise;
});
+ return deferred.promise;
};
_service.logInTwoFactor = function (code, provider) {
diff --git a/src/popup/app/vault/vaultAddSiteController.js b/src/popup/app/vault/vaultAddSiteController.js
index 2505f8d5c1..a9aaf3a89a 100644
--- a/src/popup/app/vault/vaultAddSiteController.js
+++ b/src/popup/app/vault/vaultAddSiteController.js
@@ -7,8 +7,7 @@
};
$scope.createSite = function (model) {
- var newModel = model;
- encryptSite(newModel, function (siteModel) {
+ encryptSite(model, function (siteModel) {
var site = new Site(siteModel, true);
siteService.save(site, function () {
$scope.close();
@@ -20,16 +19,17 @@
$scope.parentScope.closeAddSite();
};
- function encryptSite(siteModel, callback) {
- cryptoService.encrypt(siteModel.name, function (nameCipherString) {
+ function encryptSite(model, callback) {
+ var siteModel = {};
+ cryptoService.encrypt(model.name, function (nameCipherString) {
siteModel.name = nameCipherString;
- cryptoService.encrypt(siteModel.uri, function (uriCipherString) {
+ cryptoService.encrypt(model.uri, function (uriCipherString) {
siteModel.uri = uriCipherString;
- cryptoService.encrypt(siteModel.username, function (usernameCipherString) {
+ cryptoService.encrypt(model.username, function (usernameCipherString) {
siteModel.username = usernameCipherString;
- cryptoService.encrypt(siteModel.password, function (passwordCipherString) {
+ cryptoService.encrypt(model.password, function (passwordCipherString) {
siteModel.password = passwordCipherString;
- cryptoService.encrypt(siteModel.notes, function (notesCipherString) {
+ cryptoService.encrypt(model.notes, function (notesCipherString) {
siteModel.notes = notesCipherString;
callback(siteModel);
});
diff --git a/src/popup/app/vault/views/vaultAddSite.html b/src/popup/app/vault/views/vaultAddSite.html
index cc8328ca85..71c8c26558 100644
--- a/src/popup/app/vault/views/vaultAddSite.html
+++ b/src/popup/app/vault/views/vaultAddSite.html
@@ -15,7 +15,7 @@