From 56e1f6c25b352bd0149a4f53cfb0cdfee1a1fbcd Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 21 Sep 2017 10:43:33 -0400 Subject: [PATCH] cipher request login subclass, sync fixes --- src/_locales/en/messages.json | 5 ++++- src/models/api/requestModels.js | 19 ++++++++++++------- .../app/settings/settingsSyncController.js | 11 ++++++++--- src/services/syncService.js | 3 +++ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 54f33e0099..fd04935733 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -385,7 +385,7 @@ "message": "No" }, "unexpectedError": { - "message": "An unexpected error has occured." + "message": "An unexpected error has occurred." }, "nameRequired": { "message": "Name is required." @@ -429,6 +429,9 @@ "syncingComplete": { "message": "Syncing complete" }, + "syncingFailed": { + "message": "Syncing failed" + }, "importLoginsConfirmation": { "message": "You can bulk import logins from the bitwarden.com web vault. Do you want to visit the website now?" }, diff --git a/src/models/api/requestModels.js b/src/models/api/requestModels.js index 4495db8913..4e63292cfa 100644 --- a/src/models/api/requestModels.js +++ b/src/models/api/requestModels.js @@ -3,15 +3,20 @@ this.folderId = cipher.folderId; this.organizationId = cipher.organizationId; this.name = cipher.name ? cipher.name.encryptedString : null; + this.notes = cipher.notes ? cipher.notes.encryptedString : null; this.favorite = cipher.favorite; - if (type === 1) { - // login - this.uri = cipher.uri ? cipher.uri.encryptedString : null; - this.username = cipher.username ? cipher.username.encryptedString : null; - this.password = cipher.password ? cipher.password.encryptedString : null; - this.totp = cipher.totp ? cipher.totp.encryptedString : null; - this.notes = cipher.notes ? cipher.notes.encryptedString : null; + switch (type) { + case 1: // login + this.login = { + uri: cipher.uri ? cipher.uri.encryptedString : null, + username: cipher.username ? cipher.username.encryptedString : null, + password: cipher.password ? cipher.password.encryptedString : null, + totp: cipher.totp ? cipher.totp.encryptedString : null + }; + break; + default: + break; } }; diff --git a/src/popup/app/settings/settingsSyncController.js b/src/popup/app/settings/settingsSyncController.js index eb7dc122aa..64e3f89a04 100644 --- a/src/popup/app/settings/settingsSyncController.js +++ b/src/popup/app/settings/settingsSyncController.js @@ -9,11 +9,16 @@ $scope.sync = function () { $scope.loading = true; - syncService.fullSync(true, function () { - $analytics.eventTrack('Synced Full'); + syncService.fullSync(true, function (success) { $scope.loading = false; - toastr.success(i18nService.syncingComplete); setLastSync(); + if (success) { + $analytics.eventTrack('Synced Full'); + toastr.success(i18nService.syncingComplete); + } + else { + toastr.error(i18nService.syncingFailed); + } }); }; diff --git a/src/services/syncService.js b/src/services/syncService.js index 9abf62b2e5..045f182c90 100644 --- a/src/services/syncService.js +++ b/src/services/syncService.js @@ -61,6 +61,9 @@ function initSyncService() { self.syncCompleted(false); callback(false); }); + }, function () { + self.syncCompleted(false); + callback(false); }); }); });