diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index a07b1fd5ae..4b2159b8d0 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -765,5 +765,17 @@ }, "value": { "message": "Value" + }, + "newCustomField": { + "message": "New Custom Field" + }, + "cfTypeText": { + "message": "Text" + }, + "cfTypeHidden": { + "message": "Hidden" + }, + "cfTypeBoolean": { + "message": "Boolean" } } diff --git a/src/popup/app/vault/vaultAddLoginController.js b/src/popup/app/vault/vaultAddLoginController.js index e9994fa67f..e239fe0bab 100644 --- a/src/popup/app/vault/vaultAddLoginController.js +++ b/src/popup/app/vault/vaultAddLoginController.js @@ -2,8 +2,10 @@ .module('bit.vault') .controller('vaultAddLoginController', function ($scope, $state, $stateParams, loginService, folderService, - cryptoService, $q, toastr, utilsService, $analytics, i18nService) { + cryptoService, $q, toastr, utilsService, $analytics, i18nService, constantsService) { $scope.i18n = i18nService; + $scope.constants = constantsService; + $scope.addFieldType = constantsService.fieldType.text.toString(); var from = $stateParams.from, folderId = $stateParams.folderId; @@ -65,6 +67,25 @@ } }; + $scope.addField = function (type) { + if (!$scope.login.fields) { + $scope.login.fields = []; + } + + $scope.login.fields.push({ + type: parseInt(type), + name: null, + value: null + }); + }; + + $scope.removeField = function (field) { + var index = $scope.login.fields.indexOf(field); + if (index > -1) { + $scope.login.fields.splice(index, 1); + } + }; + $scope.generatePassword = function () { $analytics.eventTrack('Clicked Generate Password'); $state.go('passwordGenerator', { diff --git a/src/popup/app/vault/vaultEditLoginController.js b/src/popup/app/vault/vaultEditLoginController.js index 13dfa4f183..e6f709f05a 100644 --- a/src/popup/app/vault/vaultEditLoginController.js +++ b/src/popup/app/vault/vaultEditLoginController.js @@ -6,6 +6,7 @@ angular $scope.i18n = i18nService; $scope.constants = constantsService; $scope.showAttachments = !utilsService.isEdge(); + $scope.addFieldType = constantsService.fieldType.text.toString(); var loginId = $stateParams.loginId; var fromView = $stateParams.fromView; var from = $stateParams.from; @@ -94,6 +95,25 @@ angular } }; + $scope.addField = function (type) { + if (!$scope.login.fields) { + $scope.login.fields = []; + } + + $scope.login.fields.push({ + type: parseInt(type), + name: null, + value: null + }); + }; + + $scope.removeField = function (field) { + var index = $scope.login.fields.indexOf(field); + if (index > -1) { + $scope.login.fields.splice(index, 1); + } + }; + $scope.generatePassword = function () { if ($scope.login.password) { SweetAlert.swal({ diff --git a/src/popup/app/vault/views/vaultAddLogin.html b/src/popup/app/vault/views/vaultAddLogin.html index c6ae5c2bf7..6dfce6fc45 100644 --- a/src/popup/app/vault/views/vaultAddLogin.html +++ b/src/popup/app/vault/views/vaultAddLogin.html @@ -68,6 +68,45 @@ + +