diff --git a/src/popup-old/app/accounts/accountsHintController.js b/src/popup-old/app/accounts/accountsHintController.js deleted file mode 100644 index b686e04adf..0000000000 --- a/src/popup-old/app/accounts/accountsHintController.js +++ /dev/null @@ -1,43 +0,0 @@ -angular - .module('bit.accounts') - - .controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, popupUtilsService, - $analytics, i18nService, $timeout) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('email').focus(); - }, 500); - - $scope.i18n = i18nService; - $scope.model = {}; - - $scope.submitPromise = null; - $scope.submit = function (model) { - if (!model.email) { - toastr.error(i18nService.emailRequired, i18nService.errorsOccurred); - return; - } - if (model.email.indexOf('@') === -1) { - toastr.error(i18nService.invalidEmail, i18nService.errorsOccurred); - return; - } - - var request = new PasswordHintRequest(model.email); - $scope.submitPromise = hintPromise(request); - $scope.submitPromise.then(function () { - $analytics.eventTrack('Requested Hint'); - toastr.success(i18nService.masterPassSent); - $state.go('login'); - }); - }; - - function hintPromise(request) { - return $q(function (resolve, reject) { - apiService.postPasswordHint(request).then(function () { - resolve(); - }, function (error) { - reject(error); - }); - }); - } - }); diff --git a/src/popup-old/app/accounts/accountsLoginController.js b/src/popup-old/app/accounts/accountsLoginController.js deleted file mode 100644 index 5382e62459..0000000000 --- a/src/popup-old/app/accounts/accountsLoginController.js +++ /dev/null @@ -1,58 +0,0 @@ -angular - .module('bit.accounts') - - .controller('accountsLoginController', function ($scope, $state, $stateParams, authService, userService, toastr, - popupUtilsService, $analytics, i18nService, $timeout) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - if ($stateParams.email) { - document.getElementById('master-password').focus(); - } - else { - document.getElementById('email').focus(); - } - }, 500); - - $scope.i18n = i18nService; - $scope.model = { - email: $stateParams.email - }; - - $scope.loginPromise = null; - $scope.login = function (model) { - if (!model.email) { - toastr.error(i18nService.emailRequired, i18nService.errorsOccurred); - return; - } - if (model.email.indexOf('@') === -1) { - toastr.error(i18nService.invalidEmail, i18nService.errorsOccurred); - return; - } - if (!model.masterPassword) { - toastr.error(i18nService.masterPassRequired, i18nService.errorsOccurred); - return; - } - - $scope.loginPromise = authService.logIn(model.email, model.masterPassword); - - $scope.loginPromise.then(function (response) { - if (response.twoFactor) { - $analytics.eventTrack('Logged In To Two-step'); - $state.go('twoFactor', { - animation: 'in-slide-left', - email: model.email, - masterPassword: model.masterPassword, - providers: response.twoFactorProviders, - provider: null - }); - } - else { - $analytics.eventTrack('Logged In'); - $state.go('tabs.vault', { - animation: 'in-slide-left', - syncOnLoad: true - }); - } - }); - }; - }); diff --git a/src/popup-old/app/accounts/accountsLoginTwoFactorController.js b/src/popup-old/app/accounts/accountsLoginTwoFactorController.js deleted file mode 100644 index 286f505b18..0000000000 --- a/src/popup-old/app/accounts/accountsLoginTwoFactorController.js +++ /dev/null @@ -1,215 +0,0 @@ -angular - .module('bit.accounts') - - .controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, platformUtilsService, - $analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService, - environmentService, SweetAlert, popupUtilsService) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - - $scope.i18n = i18nService; - $scope.showNewWindowMessage = platformUtilsService.isSafari(); - - var customWebVaultUrl = null; - if (environmentService.baseUrl) { - customWebVaultUrl = environmentService.baseUrl; - } - else if (environmentService.webVaultUrl) { - customWebVaultUrl = environmentService.webVaultUrl; - } - - var u2f = new $window.U2f($window, customWebVaultUrl, function (data) { - $timeout(function () { - $scope.login(data); - }); - }, function (error) { - $timeout(function () { - toastr.error(error, i18nService.errorsOccurred); - }); - }, function (info) { - $timeout(function () { - if (info === 'ready') { - $scope.u2fReady = true; - } - }); - }); - - var constants = constantsService; - var email = authService.email; - var masterPasswordHash = authService.masterPasswordHash; - var providers = authService.twoFactorProviders; - - if (!email || !masterPasswordHash || !providers) { - $state.go('login'); - return; - } - - $scope.providerType = $stateParams.provider || $stateParams.provider === 0 ? $stateParams.provider : - authService.getDefaultTwoFactorProvider(platformUtilsService.supportsU2f($window)); - $scope.twoFactorEmail = null; - $scope.token = null; - $scope.constantsProvider = constants.twoFactorProvider; - $scope.u2fReady = false; - $scope.remember = { checked: false }; - init(); - - $scope.loginPromise = null; - $scope.login = function (token, sendSuccessToTab) { - if (!token) { - toastr.error(i18nService.verificationCodeRequired, i18nService.errorsOccurred); - return; - } - - if ($scope.providerType === constants.twoFactorProvider.u2f) { - if (u2f) { - u2f.stop(); - } - else { - return; - } - } - else if ($scope.providerType === constants.twoFactorProvider.email || - $scope.providerType === constants.twoFactorProvider.authenticator) { - token = token.replace(' ', ''); - } - - $scope.loginPromise = authService.logInTwoFactor($scope.providerType, token, $scope.remember.checked); - $scope.loginPromise.then(function () { - $analytics.eventTrack('Logged In From Two-step'); - $state.go('tabs.vault', { animation: 'in-slide-left', syncOnLoad: true }).then(function () { - if (sendSuccessToTab) { - $timeout(function () { - BrowserApi.tabSendMessage(sendSuccessToTab, { - command: '2faPageData', - data: { type: 'success' } - }); - }, 1000); - } - }); - }, function () { - u2f.start(); - }); - }; - - $scope.sendEmail = function (doToast) { - if ($scope.providerType !== constants.twoFactorProvider.email) { - return; - } - - var request = new TwoFactorEmailRequest(email, masterPasswordHash); - apiService.postTwoFactorEmail(request, function () { - if (doToast) { - toastr.success('Verification email sent to ' + $scope.twoFactorEmail + '.'); - } - }, function () { - toastr.error('Could not send verification email.'); - }); - }; - - $scope.anotherMethod = function () { - $state.go('twoFactorMethods', { - animation: 'in-slide-up', - provider: $scope.providerType - }); - }; - - $scope.back = function () { - $state.go('login', { - animation: 'out-slide-right' - }); - }; - - $scope.$on('$destroy', function () { - u2f.stop(); - u2f.cleanup(); - u2f = null; - }); - - $scope.$on('2faPageResponse', (event, details) => { - if (details.type === 'duo') { - $scope.login(details.data.sigValue, details.tab); - } - }); - - function init() { - u2f.stop(); - u2f.cleanup(); - - $timeout(function () { - var codeInput = document.getElementById('code'); - if (codeInput) { - codeInput.focus(); - } - - var params = providers.get($scope.providerType); - if ($scope.providerType === constants.twoFactorProvider.duo || - $scope.providerType === constants.twoFactorProvider.organizationDuo) { - if (platformUtilsService.isSafari()) { - var tab = BrowserApi.createNewTab(BrowserApi.getAssetUrl('2fa/index.html')); - var tabToSend = BrowserApi.makeTabObject(tab); - $timeout(() => { - BrowserApi.tabSendMessage(tabToSend, { - command: '2faPageData', - data: { - type: 'duo', - host: params.Host, - signature: params.Signature - } - }); - }, 500); - } - else { - $window.Duo.init({ - host: params.Host, - sig_request: params.Signature, - submit_callback: function (theForm) { - var sigElement = theForm.querySelector('input[name="sig_response"]'); - if (sigElement) { - $scope.login(sigElement.value); - } - } - }); - } - } - else if ($scope.providerType === constants.twoFactorProvider.u2f) { - var challenges = JSON.parse(params.Challenges); - - u2f.init({ - appId: challenges[0].appId, - challenge: challenges[0].challenge, - keys: [{ - version: challenges[0].version, - keyHandle: challenges[0].keyHandle - }] - }); - } - else if ($scope.providerType === constants.twoFactorProvider.email) { - $scope.twoFactorEmail = params.Email; - - if (!platformUtilsService.isSafari() && BrowserApi.isPopupOpen() && - !popupUtilsService.inSidebar($window) && !popupUtilsService.inTab($window) && - !popupUtilsService.inPopout($window)) { - SweetAlert.swal({ - title: i18nService.twoStepLogin, - text: i18nService.popup2faCloseMessage, - showCancelButton: true, - confirmButtonText: i18nService.yes, - cancelButtonText: i18nService.no - }, function (confirmed) { - if (confirmed) { - BrowserApi.createNewTab('/popup/index.html?uilocation=tab#!/login', true); - return; - } - else if (providers.size > 1) { - $scope.sendEmail(false); - } - }); - } - else if (providers.size > 1) { - $scope.sendEmail(false); - } - } - }, 500); - } - }); diff --git a/src/popup-old/app/accounts/accountsModule.js b/src/popup-old/app/accounts/accountsModule.js deleted file mode 100644 index e2f77743d6..0000000000 --- a/src/popup-old/app/accounts/accountsModule.js +++ /dev/null @@ -1,2 +0,0 @@ -angular - .module('bit.accounts', ['toastr', 'ngAnimate']); diff --git a/src/popup-old/app/accounts/accountsRegisterController.js b/src/popup-old/app/accounts/accountsRegisterController.js deleted file mode 100644 index 902ddb41c8..0000000000 --- a/src/popup-old/app/accounts/accountsRegisterController.js +++ /dev/null @@ -1,64 +0,0 @@ -angular - .module('bit.accounts') - - .controller( - 'accountsRegisterController', - function ($scope, $state, cryptoService, toastr, $q, apiService, popupUtilsService, $analytics, - i18nService, $timeout) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('email').focus(); - }, 500); - - $scope.i18n = i18nService; - $scope.model = {}; - $scope.submitPromise = null; - $scope.submit = function (model) { - if (!model.email) { - toastr.error(i18nService.emailRequired, i18nService.errorsOccurred); - return; - } - if (model.email.indexOf('@') === -1) { - toastr.error(i18nService.invalidEmail, i18nService.errorsOccurred); - return; - } - if (!model.masterPassword) { - toastr.error(i18nService.masterPassRequired, i18nService.errorsOccurred); - return; - } - if (model.masterPassword.length < 8) { - toastr.error(i18nService.masterPassLength, i18nService.errorsOccurred); - return; - } - if (model.masterPassword !== model.masterPasswordRetype) { - toastr.error(i18nService.masterPassDoesntMatch, i18nService.errorsOccurred); - return; - } - - var email = model.email.toLowerCase(); - var key = cryptoService.makeKey(model.masterPassword, email); - $scope.submitPromise = registerPromise(key, model.masterPassword, email, model.hint); - $scope.submitPromise.then(function () { - $analytics.eventTrack('Registered'); - toastr.success(i18nService.newAccountCreated); - $state.go('login', { email: email, animation: 'in-slide-left' }); - }); - }; - - function registerPromise(key, masterPassword, email, hint) { - var deferred = $q.defer(); - var encKey; - cryptoService.makeEncKey(key).then(function (theEncKey) { - encKey = theEncKey; - return cryptoService.hashPassword(masterPassword, key); - }).then(function (hashedPassword) { - var request = new RegisterRequest(email, hashedPassword, hint, encKey.encryptedString); - apiService.postRegister(request).then(function () { - deferred.resolve(); - }, function (error) { - deferred.reject(error); - }); - }); - return deferred.promise; - } - }); diff --git a/src/popup-old/app/accounts/accountsTwoFactorMethodsController.js b/src/popup-old/app/accounts/accountsTwoFactorMethodsController.js deleted file mode 100644 index 755cb52349..0000000000 --- a/src/popup-old/app/accounts/accountsTwoFactorMethodsController.js +++ /dev/null @@ -1,59 +0,0 @@ -angular - .module('bit.accounts') - - .controller('accountsTwoFactorMethodsController', function ($scope, $state, $stateParams, constantsService, - utilsService, i18nService, $analytics, platformUtilsService, authService, $window) { - $scope.i18n = i18nService; - - var constants = constantsService; - var providers = authService.twoFactorProviders; - var provider = $stateParams.provider; - - $scope.providers = []; - - if (providers.has(constants.twoFactorProvider.organizationDuo)) { - add(constants.twoFactorProvider.organizationDuo); - } - if (providers.has(constants.twoFactorProvider.authenticator)) { - add(constants.twoFactorProvider.authenticator); - } - if (providers.has(constants.twoFactorProvider.yubikey)) { - add(constants.twoFactorProvider.yubikey); - } - if (providers.has(constants.twoFactorProvider.email)) { - add(constants.twoFactorProvider.email); - } - if (providers.has(constants.twoFactorProvider.duo)) { - add(constants.twoFactorProvider.duo); - } - if (providers.has(constants.twoFactorProvider.u2f) && platformUtilsService.supportsU2f($window)) { - add(constants.twoFactorProvider.u2f); - } - - $scope.choose = function (p) { - $state.go('twoFactor', { - animation: 'out-slide-down', - provider: p.type - }); - }; - - $scope.cancel = function () { - $state.go('twoFactor', { - animation: 'out-slide-down', - provider: provider - }); - }; - - $scope.recover = function () { - $analytics.eventTrack('Selected Recover'); - BrowserApi.createNewTab('https://help.bitwarden.com/article/lost-two-step-device/'); - }; - - function add(type) { - for (var i = 0; i < constants.twoFactorProviderInfo.length; i++) { - if (constants.twoFactorProviderInfo[i].type === type) { - $scope.providers.push(constants.twoFactorProviderInfo[i]); - } - } - } - }); diff --git a/src/popup-old/app/accounts/views/accountsHint.html b/src/popup-old/app/accounts/views/accountsHint.html deleted file mode 100644 index 7a36bc4549..0000000000 --- a/src/popup-old/app/accounts/views/accountsHint.html +++ /dev/null @@ -1,28 +0,0 @@ -
-
- -
- - -
-
{{i18n.passwordHint}}
-
-
-
-
-
-
- - - -
-
- -
-
-
-
diff --git a/src/popup-old/app/accounts/views/accountsLogin.html b/src/popup-old/app/accounts/views/accountsLogin.html deleted file mode 100644 index 148b53d6be..0000000000 --- a/src/popup-old/app/accounts/views/accountsLogin.html +++ /dev/null @@ -1,34 +0,0 @@ -
-
- -
- - -
-
{{i18n.appName}}
-
-
-
-
-
-
- - - -
-
- - - -
-
-
-
-

- {{i18n.getMasterPasswordHint}} -

-
-
diff --git a/src/popup-old/app/accounts/views/accountsLoginTwoFactor.html b/src/popup-old/app/accounts/views/accountsLoginTwoFactor.html deleted file mode 100644 index f463dd8b73..0000000000 --- a/src/popup-old/app/accounts/views/accountsLoginTwoFactor.html +++ /dev/null @@ -1,170 +0,0 @@ -
-
- -
- - -
-
{{i18n.verificationCode}}
-
-
-
-

- {{i18n.enterVerificationCodeApp}} -

-

- {{i18n.enterVerificationCodeEmail}} {{twoFactorEmail}}. -

-
-
-
-
-
- - - -
-
- - -
-
-
-
-

- {{i18n.sendVerificationCodeEmailAgain}} -

-

- {{i18n.useAnotherTwoStepMethod}} -

-
-
- -
-
- -
- Duo - ({{i18n.organization}}) -
-
-
-
- -
-
-

{{i18n.twoStepNewWindowMessage}}

-
-
-
-
-
- - -
-
-
-
-

- {{i18n.useAnotherTwoStepMethod}} -

-
-
- -
-
- -
- - -
-
YubiKey
-
-
-
-

{{i18n.insertYubiKey}}

- -
-
-
-
-
- - - -
-
- - -
-
-
-
-

- {{i18n.useAnotherTwoStepMethod}} -

-
-
- -
-
- -
- -
-
FIDO U2F
-
-
-
- -

Loading...

-
-

{{i18n.insertU2f}}

- -
-
-
-
-
-
- - -
-
-
-
-

- {{i18n.useAnotherTwoStepMethod}} -

-
-
- -
-
- -
{{i18n.loginUnavailable}}
-
-
-
-

{{i18n.noTwoStepProviders}}

-

{{i18n.noTwoStepProviders2}}

-
-

- {{i18n.useAnotherTwoStepMethod}} -

-
-
diff --git a/src/popup-old/app/accounts/views/accountsRegister.html b/src/popup-old/app/accounts/views/accountsRegister.html deleted file mode 100644 index 9143e4a431..0000000000 --- a/src/popup-old/app/accounts/views/accountsRegister.html +++ /dev/null @@ -1,53 +0,0 @@ -
-
- -
- - -
-
{{i18n.createAccount}}
-
-
-
-
-
-
- - - -
-
- - - -
-
- -
-
-
-
- - - -
-
- - - -
-
- -
-
-
-
diff --git a/src/popup-old/app/accounts/views/accountsTwoFactorMethods.html b/src/popup-old/app/accounts/views/accountsTwoFactorMethods.html deleted file mode 100644 index da9499d080..0000000000 --- a/src/popup-old/app/accounts/views/accountsTwoFactorMethods.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
- {{i18n.cancel}} -
-
{{i18n.twoStepOptions}}
-
-
-
- -
-
diff --git a/src/popup-old/app/app.d.ts b/src/popup-old/app/app.d.ts deleted file mode 100644 index 7bf7506fcf..0000000000 --- a/src/popup-old/app/app.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '*.html'; diff --git a/src/popup-old/app/app.js b/src/popup-old/app/app.js deleted file mode 100644 index 51f7ce21db..0000000000 --- a/src/popup-old/app/app.js +++ /dev/null @@ -1,224 +0,0 @@ -require('clipboard'); -require('angular'); - -require('angular-animate'); -const uiRouter = require('@uirouter/angularjs').default; -require('angular-toastr'); - -require('ngclipboard'); - -require('sweetalert'); -require('angular-sweetalert'); -require('angulartics'); -require('angulartics-google-analytics'); -require('ng-infinite-scroll'); - -require('../../scripts/duo.js'); - -require('../less/libs.less'); -require('../less/popup.less'); - -import DirectivesModule from './directives/directives.module'; -import ComponentsModule from './components/components.module'; -import ToolsModule from './tools/tools.module'; -import ServicesModule from './services/services.module'; -import LockModule from './lock/lock.module'; -import CurrentModule from './current/current.module'; -import GlobalModule from './global/global.module'; -import SettingsModule from './settings/settings.module'; - -import { BrowserApi } from '../../browser/browserApi'; -window.BrowserApi = BrowserApi; -import { U2f } from '../../scripts/u2f'; -window.U2f = U2f; - -import { Analytics } from '../../../jslib/src/misc/analytics'; - -if (BrowserApi.getBackgroundPage()) { - new Analytics(window, () => BrowserApi.gaFilter(), null, null, null, () => { - const bgPage = BrowserApi.getBackgroundPage(); - if (!bgPage || !bgPage.bitwardenMain) { - throw 'Cannot resolve background page main.'; - } - return bgPage.bitwardenMain; - }); -} - -// Model imports -import { Attachment } from '../../../jslib/src/models/domain/attachment'; -import { Card } from '../../../jslib/src/models/domain/card'; -import { Cipher } from '../../../jslib/src/models/domain/cipher'; -import { CipherString } from '../../../jslib/src/models/domain/cipherString'; -import { Field } from '../../../jslib/src/models/domain/field'; -import { Folder } from '../../../jslib/src/models/domain/folder'; -import { Identity } from '../../../jslib/src/models/domain/identity'; -import { Login } from '../../../jslib/src/models/domain/login'; -import { SecureNote } from '../../../jslib/src/models/domain/secureNote'; -window.Attachment = Attachment; -window.Card = Card; -window.Cipher = Cipher; -window.CipherString = CipherString; -window.Field = Field; -window.Folder = Folder; -window.Identity = Identity; -window.Login = Login; -window.SecureNote = SecureNote; - -import { AttachmentData } from '../../../jslib/src/models/data/attachmentData'; -import { CardData } from '../../../jslib/src/models/data/cardData'; -import { CipherData } from '../../../jslib/src/models/data/cipherData'; -import { CollectionData } from '../../../jslib/src/models/data/collectionData'; -import { FieldData } from '../../../jslib/src/models/data/fieldData'; -import { FolderData } from '../../../jslib/src/models/data/folderData'; -import { IdentityData } from '../../../jslib/src/models/data/identityData'; -import { LoginData } from '../../../jslib/src/models/data/loginData'; -import { SecureNoteData } from '../../../jslib/src/models/data/secureNoteData'; -window.AttachmentData = AttachmentData; -window.CardData = CardData; -window.CipherData = CipherData; -window.CollectionData = CollectionData; -window.FieldData = FieldData; -window.FolderData = FolderData; -window.IdentityData = IdentityData; -window.LoginData = LoginData; -window.SecureNoteData = SecureNoteData; - -import { CipherRequest } from '../../../jslib/src/models/request/cipherRequest'; -import { DeviceRequest } from '../../../jslib/src/models/request/deviceRequest'; -import { DeviceTokenRequest } from '../../../jslib/src/models/request/deviceTokenRequest'; -import { FolderRequest } from '../../../jslib/src/models/request/folderRequest'; -import { PasswordHintRequest } from '../../../jslib/src/models/request/passwordHintRequest'; -import { RegisterRequest } from '../../../jslib/src/models/request/registerRequest'; -import { TokenRequest } from '../../../jslib/src/models/request/tokenRequest'; -import { TwoFactorEmailRequest } from '../../../jslib/src/models/request/twoFactorEmailRequest'; -window.CipherRequest = CipherRequest; -window.DeviceRequest = DeviceRequest; -window.DeviceTokenRequest = DeviceTokenRequest; -window.FolderRequest = FolderRequest; -window.PasswordHintRequest = PasswordHintRequest; -window.RegisterRequest = RegisterRequest; -window.TokenRequest = TokenRequest; -window.TwoFactorEmailRequest = TwoFactorEmailRequest; - -import { AttachmentResponse } from '../../../jslib/src/models/response/attachmentResponse'; -import { CipherResponse } from '../../../jslib/src/models/response/cipherResponse'; -import { CollectionResponse } from '../../../jslib/src/models/response/collectionResponse'; -import { DeviceResponse } from '../../../jslib/src/models/response/deviceResponse'; -import { DomainsResponse } from '../../../jslib/src/models/response/domainsResponse'; -import { ErrorResponse } from '../../../jslib/src/models/response/errorResponse'; -import { FolderResponse } from '../../../jslib/src/models/response/folderResponse'; -import { GlobalDomainResponse } from '../../../jslib/src/models/response/globalDomainResponse'; -import { IdentityTokenResponse } from '../../../jslib/src/models/response/identityTokenResponse'; -import { KeysResponse } from '../../../jslib/src/models/response/keysResponse'; -import { ListResponse } from '../../../jslib/src/models/response/listResponse'; -import { ProfileOrganizationResponse } from '../../../jslib/src/models/response/profileOrganizationResponse'; -import { ProfileResponse } from '../../../jslib/src/models/response/profileResponse'; -import { SyncResponse } from '../../../jslib/src/models/response/syncResponse'; -window.AttachmentResponse = AttachmentResponse; -window.CipherResponse = CipherResponse; -window.CollectionResponse = CollectionResponse; -window.DeviceResponse = DeviceResponse; -window.DomainsResponse = DomainsResponse; -window.ErrorResponse = ErrorResponse; -window.FolderResponse = FolderResponse; -window.GlobalDomainResponse = GlobalDomainResponse; -window.IdentityTokenResponse = IdentityTokenResponse; -window.KeysResponse = KeysResponse; -window.ListResponse = ListResponse; -window.ProfileOrganizationResponse = ProfileOrganizationResponse; -window.ProfileResponse = ProfileResponse; -window.SyncResponse = SyncResponse; - -angular - .module('bit', [ - uiRouter, - 'ngAnimate', - 'toastr', - 'angulartics', - 'angulartics.google.analytics', - - DirectivesModule, - ComponentsModule, - ServicesModule, - - GlobalModule, - 'bit.accounts', - CurrentModule, - 'bit.vault', - SettingsModule, - ToolsModule, - LockModule - ]); - -require('./config'); -require('./accounts/accountsModule.js'); -require('./accounts/accountsLoginController.js'); -require('./accounts/accountsLoginTwoFactorController.js'); -require('./accounts/accountsTwoFactorMethodsController.js'); -require('./accounts/accountsHintController.js'); -require('./accounts/accountsRegisterController.js'); -require('./vault/vaultModule.js'); -require('./vault/vaultController.js'); -require('./vault/vaultViewGroupingController.js'); -require('./vault/vaultAddCipherController.js'); -require('./vault/vaultEditCipherController.js'); -require('./vault/vaultViewCipherController.js'); -require('./vault/vaultAttachmentsController.js'); - -// $$ngIsClass fix issue with "class constructors must be invoked with |new|" on Firefox ESR -// ref: https://github.com/angular/angular.js/issues/14240 -import { ActionButtonsController } from './components/action-buttons.component'; -ActionButtonsController.$$ngIsClass = true; -import { CipherItemsController } from './components/cipher-items.component'; -CipherItemsController.$$ngIsClass = true; -import { IconController } from './components/icon.component'; -IconController.$$ngIsClass = true; -import { PopOutController } from './components/pop-out.component'; -PopOutController.$$ngIsClass = true; -import { CurrentController } from './current/current.component'; -CurrentController.$$ngIsClass = true; -import { LockController } from './lock/lock.component'; -LockController.$$ngIsClass = true; -import { ExportController } from './tools/export.component'; -ExportController.$$ngIsClass = true; -import { PasswordGeneratorController } from './tools/password-generator.component'; -PasswordGeneratorController.$$ngIsClass = true; -import { PasswordGeneratorHistoryController } from './tools/password-generator-history.component'; -PasswordGeneratorHistoryController.$$ngIsClass = true; -import { ToolsController } from './tools/tools.component'; -ToolsController.$$ngIsClass = true; -import { AddFolderController } from './settings/folders/add-folder.component'; -AddFolderController.$$ngIsClass = true; -import { EditFolderController } from './settings/folders/edit-folder.component'; -EditFolderController.$$ngIsClass = true; -import { FoldersController } from './settings/folders/folders.component'; -FoldersController.$$ngIsClass = true; -import { AboutController } from './settings/about.component'; -AboutController.$$ngIsClass = true; -import { CreditsController } from './settings/credits.component'; -CreditsController.$$ngIsClass = true; -import { EnvironmentController } from './settings/environment.component'; -EnvironmentController.$$ngIsClass = true; -import { OptionsController } from './settings/options.component'; -OptionsController.$$ngIsClass = true; -import { HelpController } from './settings/help.component'; -HelpController.$$ngIsClass = true; -import { PremiumController } from './settings/premium.component'; -PremiumController.$$ngIsClass = true; -import { SettingsController } from './settings/settings.component'; -SettingsController.$$ngIsClass = true; -import { SyncController } from './settings/sync.component'; -SyncController.$$ngIsClass = true; -import { BaseController } from './global/base.controller'; -BaseController.$$ngIsClass = true; -import { MainController } from './global/main.controller'; -MainController.$$ngIsClass = true; -import { PrivateModeController } from './global/private-mode.controller'; -PrivateModeController.$$ngIsClass = true; -import { TabsController } from './global/tabs.controller'; -TabsController.$$ngIsClass = true; - -// Bootstrap the angular application -angular.element(function () { - angular.bootstrap(document, ['bit']); -}); diff --git a/src/popup-old/app/components/action-buttons.component.html b/src/popup-old/app/components/action-buttons.component.html deleted file mode 100644 index 2092e92bc2..0000000000 --- a/src/popup-old/app/components/action-buttons.component.html +++ /dev/null @@ -1,60 +0,0 @@ -
-
- - - - - - - - - - - - -
-
- - - - - - - - - -
-
- - - -
-
- - - - - - -
-
diff --git a/src/popup-old/app/components/action-buttons.component.ts b/src/popup-old/app/components/action-buttons.component.ts deleted file mode 100644 index 26fb4085eb..0000000000 --- a/src/popup-old/app/components/action-buttons.component.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as template from './action-buttons.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { ConstantsService } from 'jslib/services/constants.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class ActionButtonsController implements ng.IController { - onView: Function; - - cipher: any; - showView: boolean; - i18n: any; - constants: ConstantsService; - - constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService, - private toastr: any, private $timeout: ng.ITimeoutService, private $window: ng.IWindowService) { - this.i18n = i18nService; - this.constants = constantsService; - } - - launch() { - const self = this; - this.$timeout(() => { - if (self.cipher.login.uri.startsWith('http://') || self.cipher.login.uri.startsWith('https://')) { - self.$analytics.eventTrack('Launched Website From Listing'); - BrowserApi.createNewTab(self.cipher.login.uri); - if (PopupUtilsService.inPopup(self.$window)) { - BrowserApi.closePopup(self.$window); - } - } - }); - } - - clipboardError(e: any) { - this.toastr.info(this.i18nService.browserNotSupportClipboard); - } - - clipboardSuccess(e: any, type: string, aType: string) { - e.clearSelection(); - this.$analytics.eventTrack('Copied ' + aType); - this.toastr.info(type + this.i18nService.valueCopied); - } -} - -ActionButtonsController.$inject = ['i18nService', '$analytics', 'constantsService', 'toastr', '$timeout', '$window']; - -export const ActionButtonsComponent = { - bindings: { - cipher: '<', - showView: '<', - onView: '&', - }, - controller: ActionButtonsController, - template: template, -}; diff --git a/src/popup-old/app/components/cipher-items.component.html b/src/popup-old/app/components/cipher-items.component.html deleted file mode 100644 index 7320541cea..0000000000 --- a/src/popup-old/app/components/cipher-items.component.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - {{cipher.name}} - - - - {{cipher.subTitle}} - diff --git a/src/popup-old/app/components/cipher-items.component.ts b/src/popup-old/app/components/cipher-items.component.ts deleted file mode 100644 index 899bacbde9..0000000000 --- a/src/popup-old/app/components/cipher-items.component.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as template from './cipher-items.component.html'; - -export class CipherItemsController implements ng.IController { - onSelected: Function; - onView: Function; - - i18n: any; - - constructor(private i18nService: any) { - this.i18n = i18nService; - } - - view(cipher: any) { - return this.onView({ cipher: cipher }); - } - - select(cipher: any) { - return this.onSelected({ cipher: cipher }); - } -} - -CipherItemsController.$inject = ['i18nService']; - -export const CipherItemsComponent = { - bindings: { - ciphers: '<', - selectionTitle: '<', - onSelected: '&', - onView: '&', - }, - controller: CipherItemsController, - template: template, -}; diff --git a/src/popup-old/app/components/components.module.ts b/src/popup-old/app/components/components.module.ts deleted file mode 100644 index 3505c2b594..0000000000 --- a/src/popup-old/app/components/components.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as angular from 'angular'; -import { ActionButtonsComponent } from './action-buttons.component'; -import { CipherItemsComponent } from './cipher-items.component'; -import { IconComponent } from './icon.component'; -import { PopOutComponent } from './pop-out.component'; - -export default angular - .module('bit.components', []) - .component('cipherItems', CipherItemsComponent) - .component('icon', IconComponent) - .component('actionButtons', ActionButtonsComponent) - .component('popOut', PopOutComponent) - .name; diff --git a/src/popup-old/app/components/icon.component.html b/src/popup-old/app/components/icon.component.html deleted file mode 100644 index 877f058830..0000000000 --- a/src/popup-old/app/components/icon.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/src/popup-old/app/components/icon.component.ts b/src/popup-old/app/components/icon.component.ts deleted file mode 100644 index 6962e37288..0000000000 --- a/src/popup-old/app/components/icon.component.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as template from './icon.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { CipherType } from 'jslib/enums/cipherType'; - -import { EnvironmentService } from 'jslib/abstractions/environment.service'; - -export class IconController implements ng.IController { - cipher: any; - icon: string; - image: string; - fallbackImage: string; - imageEnabled: boolean; - - private iconsUrl: string; - - constructor(private stateService: any, private environmentService: EnvironmentService) { - this.imageEnabled = stateService.getState('faviconEnabled'); - - this.iconsUrl = environmentService.iconsUrl; - if (!this.iconsUrl) { - if (environmentService.baseUrl) { - this.iconsUrl = environmentService.baseUrl + '/icons'; - } else { - this.iconsUrl = 'https://icons.bitwarden.com'; - } - } - } - - $onChanges() { - switch (this.cipher.type) { - case CipherType.Login: - this.icon = 'fa-globe'; - this.setLoginIcon(); - break; - case CipherType.SecureNote: - this.icon = 'fa-sticky-note-o'; - break; - case CipherType.Card: - this.icon = 'fa-credit-card'; - break; - case CipherType.Identity: - this.icon = 'fa-id-card-o'; - break; - default: - break; - } - } - - private setLoginIcon() { - if (this.cipher.login.uri) { - let hostnameUri = this.cipher.login.uri; - let isWebsite = false; - - if (hostnameUri.indexOf('androidapp://') === 0) { - this.icon = 'fa-android'; - this.image = null; - } else if (hostnameUri.indexOf('iosapp://') === 0) { - this.icon = 'fa-apple'; - this.image = null; - } else if (this.imageEnabled && hostnameUri.indexOf('://') === -1 && hostnameUri.indexOf('.') > -1) { - hostnameUri = 'http://' + hostnameUri; - isWebsite = true; - } else if (this.imageEnabled) { - isWebsite = hostnameUri.indexOf('http') === 0 && hostnameUri.indexOf('.') > -1; - } - - if (this.imageEnabled && isWebsite) { - try { - const url = new URL(hostnameUri); - this.image = this.iconsUrl + '/' + url.hostname + '/icon.png'; - this.fallbackImage = BrowserApi.getAssetUrl('images/fa-globe.png'); - } catch (e) { } - } - } else { - this.image = null; - } - } -} - -IconController.$inject = ['stateService', 'environmentService']; - -export const IconComponent = { - bindings: { - cipher: '<', - }, - controller: IconController, - template: template, -}; diff --git a/src/popup-old/app/components/pop-out.component.html b/src/popup-old/app/components/pop-out.component.html deleted file mode 100644 index 27d98975a6..0000000000 --- a/src/popup-old/app/components/pop-out.component.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/popup-old/app/components/pop-out.component.ts b/src/popup-old/app/components/pop-out.component.ts deleted file mode 100644 index 0611f715f4..0000000000 --- a/src/popup-old/app/components/pop-out.component.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as template from './pop-out.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class PopOutController implements ng.IController { - i18n: any; - - constructor(private $analytics: any, private $window: ng.IWindowService, - private platformUtilsService: PlatformUtilsService, private i18nService: any) { - this.i18n = i18nService; - } - - expand() { - this.$analytics.eventTrack('Expand Vault'); - - let href = this.$window.location.href; - if (this.platformUtilsService.isEdge()) { - const popupIndex = href.indexOf('/popup/'); - if (popupIndex > -1) { - href = href.substring(popupIndex); - } - } - - if ((typeof chrome !== 'undefined') && chrome.windows && chrome.windows.create) { - if (href.indexOf('?uilocation=') > -1) { - href = href.replace('uilocation=popup', 'uilocation=popout') - .replace('uilocation=tab', 'uilocation=popout') - .replace('uilocation=sidebar', 'uilocation=popout'); - } else { - const hrefParts = href.split('#'); - href = hrefParts[0] + '?uilocation=popout' + (hrefParts.length > 0 ? '#' + hrefParts[1] : ''); - } - - const bodyRect = document.querySelector('body').getBoundingClientRect(); - chrome.windows.create({ - url: href, - type: 'popup', - width: bodyRect.width + 60, - height: bodyRect.height, - }); - - if (PopupUtilsService.inPopup(this.$window)) { - BrowserApi.closePopup(this.$window); - } - } else if ((typeof chrome !== 'undefined') && chrome.tabs && chrome.tabs.create) { - href = href.replace('uilocation=popup', 'uilocation=tab') - .replace('uilocation=popout', 'uilocation=tab') - .replace('uilocation=sidebar', 'uilocation=tab'); - chrome.tabs.create({ - url: href, - }); - } else if ((typeof safari !== 'undefined')) { - // Safari can't open popup in full page tab :( - } - } -} - -PopOutController.$inject = ['$analytics', '$window', 'platformUtilsService', 'i18nService']; - -export const PopOutComponent = { - bindings: {}, - controller: PopOutController, - template: template, -}; diff --git a/src/popup-old/app/config.js b/src/popup-old/app/config.js deleted file mode 100644 index fa47f26e88..0000000000 --- a/src/popup-old/app/config.js +++ /dev/null @@ -1,282 +0,0 @@ -angular - .module('bit') - - .config(function ($stateProvider, $urlRouterProvider, $compileProvider, $sceDelegateProvider, toastrConfig) { - $compileProvider.imgSrcSanitizationWhitelist( - /^\s*((https?|ftp|file|blob):|data:image\/|(moz|chrome|ms-browser)-extension)/); - - angular.extend(toastrConfig, { - closeButton: true, - progressBar: true, - showMethod: 'slideDown', - positionClass: 'toast-bottom-center' - }); - - $urlRouterProvider.otherwise(function ($injector, $location) { - var $state = $injector.get('$state'); - - if (!BrowserApi.getBackgroundPage()) { - $state.go('privateMode'); - return; - } - - var userService = $injector.get('userService'); - var cryptoService = $injector.get('cryptoService'); - - var key; - cryptoService.getKey().then(function (theKey) { - key = theKey; - return userService.isAuthenticated(); - }).then(function (isAuthenticated) { - if (isAuthenticated) { - if (!key) { - $state.go('lock'); - } - else { - $state.go('tabs.current'); - } - } - else { - $state.go('home'); - } - }); - }); - - $stateProvider - .state('splash', { - url: '/splash', - controller: 'baseController', - template: require('./global/splash.html'), - data: { authorize: false }, - params: { animation: null } - }) - .state('privateMode', { - url: '/private-mode', - controller: 'privateModeController', - template: require('./global/private-mode.html'), - data: { authorize: false }, - params: { animation: null } - }) - .state('home', { - url: '/home', - controller: 'baseController', - template: require('./global/home.html'), - data: { authorize: false }, - params: { animation: null } - }) - - .state('login', { - url: '/login', - controller: 'accountsLoginController', - template: require('./accounts/views/accountsLogin.html'), - data: { authorize: false }, - params: { animation: null, email: null } - }) - .state('hint', { - url: '/hint', - controller: 'accountsHintController', - template: require('./accounts/views/accountsHint.html'), - data: { authorize: false }, - params: { animation: null } - }) - .state('twoFactor', { - url: '/two-factor', - controller: 'accountsLoginTwoFactorController', - template: require('./accounts/views/accountsLoginTwoFactor.html'), - data: { authorize: false }, - params: { animation: null, provider: null } - }) - .state('twoFactorMethods', { - url: '/two-factor-methods', - controller: 'accountsTwoFactorMethodsController', - template: require('./accounts/views/accountsTwoFactorMethods.html'), - data: { authorize: false }, - params: { animation: null, provider: null } - }) - .state('register', { - url: '/register', - controller: 'accountsRegisterController', - template: require('./accounts/views/accountsRegister.html'), - data: { authorize: false }, - params: { animation: null } - }) - - .state('tabs', { - url: '/tab', - abstract: true, - template: require('./global/tabs.html'), - data: { authorize: true }, - params: { animation: null } - }) - .state('tabs.current', { - url: '/current', - component: 'current' - }) - .state('tabs.vault', { - url: '/vault', - template: require('./vault/views/vault.html'), - controller: 'vaultController', - params: { syncOnLoad: false, searchText: null } - }) - .state('tabs.settings', { - url: '/settings', - component: 'settings', - }) - .state('tabs.tools', { - url: '/tools', - component: 'tools' - }) - - .state('viewGrouping', { - url: '/view-grouping?folderId&collectionId', - template: require('./vault/views/vaultViewGrouping.html'), - controller: 'vaultViewGroupingController', - data: { authorize: true }, - params: { animation: null, from: 'vault' } - }) - .state('viewCipher', { - url: '/view-cipher?cipherId', - template: require('./vault/views/vaultViewCipher.html'), - controller: 'vaultViewCipherController', - data: { authorize: true }, - params: { animation: null, from: 'vault' } - }) - .state('addCipher', { - url: '/add-cipher', - template: require('./vault/views/vaultAddCipher.html'), - controller: 'vaultAddCipherController', - data: { authorize: true }, - params: { animation: null, name: null, uri: null, folderId: null, cipher: null, from: 'vault' } - }) - .state('editCipher', { - url: '/edit-cipher?cipherId', - template: require('./vault/views/vaultEditCipher.html'), - controller: 'vaultEditCipherController', - data: { authorize: true }, - params: { animation: null, fromView: true, cipher: null, from: 'vault' } - }) - .state('attachments', { - url: '/attachments?id', - template: require('./vault/views/vaultAttachments.html'), - controller: 'vaultAttachmentsController', - data: { authorize: true }, - params: { animation: null, fromView: true, from: 'vault' } - }) - - .state('passwordGenerator', { - url: '/password-generator', - component: 'passwordGenerator', - data: { authorize: true }, - params: { animation: null, addState: null, editState: null } - }) - .state('passwordGeneratorHistory', { - url: '/password-generator-history', - component: 'passwordGeneratorHistory', - data: { authorize: true }, - params: { animation: null, addState: null, editState: null } - }) - .state('export', { - url: '/export', - component: 'export', - data: { authorize: true }, - params: { animation: null } - }) - - .state('about', { - url: '/about', - component: 'about', - data: { authorize: true }, - params: { animation: null } - }) - .state('credits', { - url: '/credits', - component: 'credits', - data: { authorize: true }, - params: { animation: null } - }) - .state('options', { - url: '/options', - component: 'options', - data: { authorize: true }, - params: { animation: null } - }) - .state('help', { - url: '/help', - component: 'help', - data: { authorize: true }, - params: { animation: null } - }) - .state('sync', { - url: '/sync', - component: 'sync', - data: { authorize: true }, - params: { animation: null } - }) - .state('premium', { - url: '/premium', - component: 'premium', - data: { authorize: true }, - params: { animation: null } - }) - - .state('folders', { - url: '/folders', - abstract: true, - data: { authorize: true }, - params: { animation: null } - }) - .state('folders.list', { - url: '', - component: 'folders', - }) - .state('folders.add', { - url: '/add', - component: 'addFolder', - }) - .state('folders.edit', { - url: '/{folderId}/edit', - component: 'editFolder', - }) - .state('environment', { - url: '/environment', - component: 'environment', - data: { authorize: false }, - params: { animation: null } - }) - .state('lock', { - url: '/lock', - component: 'lock', - data: { authorize: true }, - params: { animation: null } - }); - }) - .run(function ($trace, $transitions, userService, $state, constantsService, stateService, - storageService, messagingService) { - stateService.init(); - - $transitions.onStart({}, function (trans) { - const $state = trans.router.stateService; - const toState = trans.to(); - - if ($state.current.name.indexOf('tabs.') > -1 && toState.name.indexOf('tabs.') > -1) { - stateService.removeState('vault'); - stateService.removeState('viewGrouping'); - } - - const userService = trans.injector().get('userService'); - - if (!userService) { - return; - } - - userService.isAuthenticated().then((isAuthenticated) => { - if (isAuthenticated) { - storageService.save(constantsService.lastActiveKey, (new Date()).getTime()); - } - else if (toState.data && toState.data.authorize) { - event.preventDefault(); - messagingService.send('logout'); - } - }); - }); - }); diff --git a/src/popup-old/app/current/current.component.html b/src/popup-old/app/current/current.component.html deleted file mode 100644 index 350118f253..0000000000 --- a/src/popup-old/app/current/current.component.html +++ /dev/null @@ -1,63 +0,0 @@ - -
-
-
-
- {{$ctrl.i18n.typeLogins}} -
-
- - -
-

{{$ctrl.i18n.autoFillInfo}}

- -
-
-
-
-
- {{$ctrl.i18n.cards}} -
-
- - -
-
-
-
- {{$ctrl.i18n.identities}} -
-
- - -
-
-
-
- -
-
diff --git a/src/popup-old/app/current/current.component.ts b/src/popup-old/app/current/current.component.ts deleted file mode 100644 index 36f552d6fb..0000000000 --- a/src/popup-old/app/current/current.component.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as template from './current.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { CipherType } from 'jslib/enums/cipherType'; - -import { CipherService } from 'jslib/abstractions/cipher.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; -import { UtilsService } from 'jslib/abstractions/utils.service'; - -import { AutofillService } from '../../../services/abstractions/autofill.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class CurrentController { - i18n: any; - pageDetails: any = []; - loaded: boolean = false; - cardCiphers: any = []; - identityCiphers: any = []; - loginCiphers: any = []; - url: string; - domain: string; - canAutofill: boolean = false; - searchText: string = null; - inSidebar: boolean = false; - showPopout: boolean = true; - disableSearch: boolean = false; - - constructor($scope: any, private cipherService: CipherService, private platformUtilsService: PlatformUtilsService, - private utilsService: UtilsService, private toastr: any, private $window: ng.IWindowService, - private $state: any, private $timeout: ng.ITimeoutService, private autofillService: AutofillService, - private $analytics: any, private i18nService: any, private $filter: ng.IFilterService) { - this.i18n = i18nService; - this.inSidebar = PopupUtilsService.inSidebar($window); - this.showPopout = !this.inSidebar && !platformUtilsService.isSafari(); - this.disableSearch = platformUtilsService.isEdge(); - - $scope.$on('syncCompleted', (event: any, successfully: boolean) => { - if (this.loaded) { - $timeout(this.loadVault.bind(this), 500); - } - }); - - $scope.$on('collectPageDetailsResponse', (event: any, details: any) => { - this.pageDetails.push(details); - }); - } - - $onInit() { - this.$timeout(() => { - document.getElementById('search').focus(); - }, 50); - - this.loadVault(); - } - - async refresh() { - await this.loadVault(); - } - - addCipher() { - this.$state.go('addCipher', { - animation: 'in-slide-up', - name: this.domain, - uri: this.url, - from: 'current', - }); - } - - viewCipher(cipher: any) { - this.$state.go('viewCipher', { - cipherId: cipher.id, - animation: 'in-slide-up', - from: 'current', - }); - } - - fillCipher(cipher: any) { - if (!this.canAutofill) { - this.$analytics.eventTrack('Autofilled Error'); - this.toastr.error(this.i18nService.autofillError); - } - - this.autofillService.doAutoFill({ - cipher: cipher, - pageDetails: this.pageDetails, - fromBackground: false, - doc: this.$window.document, - }).then((totpCode: string) => { - this.$analytics.eventTrack('Autofilled'); - if (totpCode && this.platformUtilsService.isFirefox()) { - this.utilsService.copyToClipboard(totpCode, document); - } - if (PopupUtilsService.inPopup(this.$window)) { - BrowserApi.closePopup(this.$window); - } - }).catch(() => { - this.$analytics.eventTrack('Autofilled Error'); - this.toastr.error(this.i18nService.autofillError); - }); - } - - searchVault() { - this.$state.go('tabs.vault', { - searchText: this.searchText, - }); - } - - private async loadVault() { - const tab = await BrowserApi.getTabFromCurrentWindow(); - if (tab) { - this.url = tab.url; - } else { - this.$timeout(() => { - this.loaded = true; - }); - return; - } - - this.domain = this.platformUtilsService.getDomain(this.url); - - BrowserApi.tabSendMessage(tab, { - command: 'collectPageDetails', - tab: tab, - sender: 'currentController', - }).then(() => { - this.canAutofill = true; - }); - - const otherTypes = [ - CipherType.Card, - CipherType.Identity, - ]; - - const ciphers = await this.cipherService.getAllDecryptedForUrl(this.url, otherTypes); - const loginCiphers: any = []; - const cardCiphers: any = []; - const identityCiphers: any = []; - - const sortedCiphers = this.$filter('orderBy')(ciphers, - [this.sortUriMatch, this.sortLastUsed, 'name', 'subTitle']); - - sortedCiphers.forEach((cipher: any) => { - switch (cipher.type) { - case CipherType.Login: - loginCiphers.push(cipher); - break; - case CipherType.Card: - cardCiphers.push(cipher); - break; - case CipherType.Identity: - identityCiphers.push(cipher); - break; - default: - break; - } - }); - - this.$timeout(() => { - this.loginCiphers = loginCiphers; - this.cardCiphers = cardCiphers; - this.identityCiphers = identityCiphers; - this.loaded = true; - }); - } - - private sortUriMatch(cipher: any) { - // exact matches should sort earlier. - return cipher.login && cipher.login.uri && this.url && this.url.startsWith(cipher.login.uri) ? 0 : 1; - } - - private sortLastUsed(cipher: any) { - return cipher.localData && cipher.localData.lastUsedDate ? -1 * cipher.localData.lastUsedDate : 0; - } -} - -CurrentController.$inject = ['$scope', 'cipherService', 'platformUtilsService', 'utilsService', 'toastr', '$window', - '$state', '$timeout', 'autofillService', '$analytics', 'i18nService', '$filter']; - -export const CurrentComponent = { - bindings: {}, - controller: CurrentController, - template: template, -}; diff --git a/src/popup-old/app/current/current.module.ts b/src/popup-old/app/current/current.module.ts deleted file mode 100644 index a3bbd942a4..0000000000 --- a/src/popup-old/app/current/current.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as angular from 'angular'; -import { CurrentComponent } from './current.component'; - -export default angular - .module('bit.current', ['toastr', 'ngclipboard']) - - .component('current', CurrentComponent) - - .name; diff --git a/src/popup-old/app/directives/bit-form.directive.ts b/src/popup-old/app/directives/bit-form.directive.ts deleted file mode 100644 index ff09f336f1..0000000000 --- a/src/popup-old/app/directives/bit-form.directive.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ValidationService } from '../services/validation.service'; - -export function BitFormDirective($rootScope: ng.IRootScopeService, validationService: ValidationService) { - return { - require: 'form', - restrict: 'A', - link: (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, formCtrl: ng.IFormController) => { - const watchPromise = attrs.bitForm || null; - if (watchPromise) { - scope.$watch(watchPromise, formSubmitted.bind(null, formCtrl, scope)); - } - }, - }; - - function formSubmitted(form: any, scope: ng.IScope, promise: any) { - if (!promise || !promise.then) { - return; - } - - // start loading - form.$loading = true; - - promise.then((response: any) => { - form.$loading = false; - }, (reason: any) => { - form.$loading = false; - validationService.showError(reason); - }); - } -} diff --git a/src/popup-old/app/directives/directives.module.ts b/src/popup-old/app/directives/directives.module.ts deleted file mode 100644 index 8ecfe3e1f8..0000000000 --- a/src/popup-old/app/directives/directives.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as angular from 'angular'; - -import { BitFormDirective } from './bit-form.directive'; -import { FallbackSrcDirective } from './fallback-src.directive'; -import { StopClickDirective } from './stop-click.directive'; -import { StopPropDirective } from './stop-prop.directive'; - -export default angular - .module('bit.directives', []) - - .directive('fallbackSrc', FallbackSrcDirective) - .directive('stopClick', StopClickDirective) - .directive('stopProp', StopPropDirective) - .directive('bitForm', BitFormDirective) - - .name; diff --git a/src/popup-old/app/directives/fallback-src.directive.ts b/src/popup-old/app/directives/fallback-src.directive.ts deleted file mode 100644 index 8a8a540dcc..0000000000 --- a/src/popup-old/app/directives/fallback-src.directive.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function FallbackSrcDirective() { - return (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) => { - element[0].addEventListener('error', (e: any) => { - e.target.src = attrs.fallbackSrc; - }); - }; -} diff --git a/src/popup-old/app/directives/stop-click.directive.ts b/src/popup-old/app/directives/stop-click.directive.ts deleted file mode 100644 index 34cac772e8..0000000000 --- a/src/popup-old/app/directives/stop-click.directive.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function StopClickDirective() { - // ref: https://stackoverflow.com/a/14165848/1090359 - return (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) => { - element[0].addEventListener('click', (e) => { - e.preventDefault(); - }); - }; -} diff --git a/src/popup-old/app/directives/stop-prop.directive.ts b/src/popup-old/app/directives/stop-prop.directive.ts deleted file mode 100644 index 6f161341c6..0000000000 --- a/src/popup-old/app/directives/stop-prop.directive.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function StopPropDirective() { - return (scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) => { - element[0].addEventListener('click', (e) => { - e.stopPropagation(); - }); - }; -} diff --git a/src/popup-old/app/global/base.controller.ts b/src/popup-old/app/global/base.controller.ts deleted file mode 100644 index 16333ba171..0000000000 --- a/src/popup-old/app/global/base.controller.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class BaseController implements ng.IController { - constructor($scope: any, i18nService: any) { - $scope.i18n = i18nService; - } -} - -BaseController.$inject = ['$scope', 'i18nService']; diff --git a/src/popup-old/app/global/empty.html b/src/popup-old/app/global/empty.html deleted file mode 100644 index 6262356fc8..0000000000 --- a/src/popup-old/app/global/empty.html +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/src/popup-old/app/global/global.module.ts b/src/popup-old/app/global/global.module.ts deleted file mode 100644 index f56dcd0d2b..0000000000 --- a/src/popup-old/app/global/global.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as angular from 'angular'; -import { BaseController } from './base.controller'; -import { MainController } from './main.controller'; -import { PrivateModeController } from './private-mode.controller'; -import { TabsController } from './tabs.controller'; - -export default angular - .module('bit.global', ['ngAnimate']) - - .controller('mainController', MainController) - .controller('baseController', BaseController) - .controller('tabsController', TabsController) - .controller('privateModeController', PrivateModeController) - - .name; diff --git a/src/popup-old/app/global/home.html b/src/popup-old/app/global/home.html deleted file mode 100644 index 19485046c2..0000000000 --- a/src/popup-old/app/global/home.html +++ /dev/null @@ -1,17 +0,0 @@ -
- -  {{i18n.settings}} - - bitwarden -

{{i18n.loginOrCreateNewAccount}}

-
- - {{i18n.createAccount}} - - - {{i18n.login}} - -
-
diff --git a/src/popup-old/app/global/main.controller.ts b/src/popup-old/app/global/main.controller.ts deleted file mode 100644 index a45401c6d8..0000000000 --- a/src/popup-old/app/global/main.controller.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { BrowserApi } from '../../../browser/browserApi'; - -import { AuthService } from 'jslib/abstractions/auth.service'; -import { UtilsService } from 'jslib/abstractions/utils.service'; - -export class MainController implements ng.IController { - smBody: boolean; - xsBody: boolean; - animation: string; - - constructor($scope: any, $transitions: any, $state: any, authService: AuthService, toastr: any, - i18nService: any, $analytics: any, utilsService: UtilsService, $window: ng.IWindowService) { - this.animation = ''; - this.xsBody = $window.screen.availHeight < 600; - this.smBody = !this.xsBody && $window.screen.availHeight <= 800; - - $transitions.onSuccess({}, (transition: any) => { - const toParams = transition.params('to'); - - if (toParams.animation) { - this.animation = toParams.animation; - } else { - this.animation = ''; - } - }); - - $window.bitwardenPopupMainMessageListener = (msg: any, sender: any, sendResponse: any) => { - if (msg.command === 'syncCompleted') { - $scope.$broadcast('syncCompleted', msg.successfully); - } else if (msg.command === 'syncStarted') { - $scope.$broadcast('syncStarted'); - } else if (msg.command === 'doneLoggingOut') { - authService.logOut(() => { - $analytics.eventTrack('Logged Out'); - if (msg.expired) { - toastr.warning(i18nService.loginExpired, i18nService.loggedOut); - } - $state.go('home'); - }); - } else if (msg.command === 'collectPageDetailsResponse' && - msg.sender === 'currentController') { - $scope.$broadcast('collectPageDetailsResponse', { - frameId: sender.frameId, - tab: msg.tab, - details: msg.details, - }); - } else if (msg.command === '2faPageResponse') { - $scope.$broadcast('2faPageResponse', { - type: msg.type, - data: msg.data, - tab: sender.tab, - }); - } - }; - - BrowserApi.messageListener($window.bitwardenPopupMainMessageListener); - } -} - -MainController.$inject = ['$scope', '$transitions', '$state', 'authService', 'toastr', 'i18nService', '$analytics', - 'utilsService', '$window']; diff --git a/src/popup-old/app/global/private-mode.controller.ts b/src/popup-old/app/global/private-mode.controller.ts deleted file mode 100644 index a6d728f7b0..0000000000 --- a/src/popup-old/app/global/private-mode.controller.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { BrowserApi } from '../../../browser/browserApi'; - -export class PrivateModeController implements ng.IController { - constructor($scope: any) { - $scope.privateModeMessage = chrome.i18n.getMessage('privateModeMessage'); - $scope.learnMoreMessage = chrome.i18n.getMessage('learnMore'); - $scope.learnMore = () => { - BrowserApi.createNewTab('https://help.bitwarden.com/article/extension-wont-load-in-private-mode/'); - }; - } -} - -PrivateModeController.$inject = ['$scope']; diff --git a/src/popup-old/app/global/private-mode.html b/src/popup-old/app/global/private-mode.html deleted file mode 100644 index 096b92820f..0000000000 --- a/src/popup-old/app/global/private-mode.html +++ /dev/null @@ -1,6 +0,0 @@ -
-

{{privateModeMessage}}

- -
diff --git a/src/popup-old/app/global/splash.html b/src/popup-old/app/global/splash.html deleted file mode 100644 index 4a088fc103..0000000000 --- a/src/popup-old/app/global/splash.html +++ /dev/null @@ -1,5 +0,0 @@ -
-
- bitwarden -
-
diff --git a/src/popup-old/app/global/tabs.controller.ts b/src/popup-old/app/global/tabs.controller.ts deleted file mode 100644 index e0f76dc82e..0000000000 --- a/src/popup-old/app/global/tabs.controller.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class TabsController implements ng.IController { - constructor($scope: any, $state: any, i18nService: any) { - $scope.$state = $state; - $scope.i18n = i18nService; - } -} - -TabsController.$inject = ['$scope', '$state', 'i18nService']; diff --git a/src/popup-old/app/global/tabs.html b/src/popup-old/app/global/tabs.html deleted file mode 100644 index ee31618ea5..0000000000 --- a/src/popup-old/app/global/tabs.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
- -
diff --git a/src/popup-old/app/lock/lock.component.html b/src/popup-old/app/lock/lock.component.html deleted file mode 100644 index b8b4c14121..0000000000 --- a/src/popup-old/app/lock/lock.component.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
-
- -
-
{{$ctrl.i18n.verifyMasterPassword}}
-
-
-
-
-
-
- - - -
-
-
-
-

- {{$ctrl.i18n.logOut}} -

-
-
diff --git a/src/popup-old/app/lock/lock.component.ts b/src/popup-old/app/lock/lock.component.ts deleted file mode 100644 index 0282a8bc08..0000000000 --- a/src/popup-old/app/lock/lock.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as angular from 'angular'; -import * as template from './lock.component.html'; - -import { CryptoService } from 'jslib/abstractions/crypto.service'; -import { MessagingService } from 'jslib/abstractions/messaging.service'; -import { UserService } from 'jslib/abstractions/user.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class LockController { - i18n: any; - masterPassword: string; - - constructor(public $state: any, public i18nService: any, private $timeout: ng.ITimeoutService, - public cryptoService: CryptoService, public toastr: any, public userService: UserService, - public messagingService: MessagingService, public SweetAlert: any) { - this.i18n = i18nService; - } - - $onInit() { - this.$timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('master-password').focus(); - }, 500); - } - - logOut() { - this.SweetAlert.swal({ - title: this.i18nService.logOut, - text: this.i18nService.logOutConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - if (confirmed) { - this.messagingService.send('logout'); - } - }); - } - - async submit() { - if (this.masterPassword == null || this.masterPassword === '') { - this.toastr.error(this.i18nService.invalidMasterPassword, this.i18nService.errorsOccurred); - return; - } - - const email = await this.userService.getEmail(); - const key = this.cryptoService.makeKey(this.masterPassword, email); - const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key); - const storedKeyHash = await this.cryptoService.getKeyHash(); - - if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) { - await this.cryptoService.setKey(key); - this.messagingService.send('unlocked'); - this.$state.go('tabs.current'); - } else { - this.toastr.error(this.i18nService.invalidMasterPassword, this.i18nService.errorsOccurred); - } - } -} - -LockController.$inject = ['$state', 'i18nService', '$timeout', 'cryptoService', 'toastr', 'userService', - 'messagingService', 'SweetAlert']; - -export const LockComponent = { - bindings: {}, - controller: LockController, - template: template, -}; diff --git a/src/popup-old/app/lock/lock.module.ts b/src/popup-old/app/lock/lock.module.ts deleted file mode 100644 index a505ebaed3..0000000000 --- a/src/popup-old/app/lock/lock.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import * as angular from 'angular'; -import { LockComponent } from './lock.component'; - -export default angular - .module('bit.lock', ['ngAnimate', 'toastr']) - - .component('lock', LockComponent) - - .name; diff --git a/src/popup-old/app/services/background.service.ts b/src/popup-old/app/services/background.service.ts deleted file mode 100644 index 2b3ae7934b..0000000000 --- a/src/popup-old/app/services/background.service.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { BrowserApi } from '../../../browser/browserApi'; - -import { ConstantsService } from 'jslib/services/constants.service'; - -import { ApiService } from 'jslib/abstractions/api.service'; -import { AppIdService } from 'jslib/abstractions/appId.service'; -import { AuditService } from 'jslib/abstractions/audit.service'; -import { CipherService } from 'jslib/abstractions/cipher.service'; -import { CollectionService } from 'jslib/abstractions/collection.service'; -import { CryptoService } from 'jslib/abstractions/crypto.service'; -import { EnvironmentService } from 'jslib/abstractions/environment.service'; -import { FolderService } from 'jslib/abstractions/folder.service'; -import { I18nService } from 'jslib/abstractions/i18n.service'; -import { LockService } from 'jslib/abstractions/lock.service'; -import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; -import { SettingsService } from 'jslib/abstractions/settings.service'; -import { StorageService } from 'jslib/abstractions/storage.service'; -import { SyncService } from 'jslib/abstractions/sync.service'; -import { TokenService } from 'jslib/abstractions/token.service'; -import { TotpService } from 'jslib/abstractions/totp.service'; -import { UserService } from 'jslib/abstractions/user.service'; -import { UtilsService } from 'jslib/abstractions/utils.service'; - -import { AutofillService } from '../../../services/abstractions/autofill.service'; - -function getBackgroundService(service: string) { - return (): T => { - const page = BrowserApi.getBackgroundPage(); - return page ? page.bitwardenMain[service] as T : null; - }; -} - -export const storageService = getBackgroundService('storageService'); -export const tokenService = getBackgroundService('tokenService'); -export const cryptoService = getBackgroundService('cryptoService'); -export const userService = getBackgroundService('userService'); -export const apiService = getBackgroundService('apiService'); -export const folderService = getBackgroundService('folderService'); -export const cipherService = getBackgroundService('cipherService'); -export const syncService = getBackgroundService('syncService'); -export const autofillService = getBackgroundService('autofillService'); -export const passwordGenerationService = getBackgroundService('passwordGenerationService'); -export const platformUtilsService = getBackgroundService('platformUtilsService'); -export const utilsService = getBackgroundService('utilsService'); -export const appIdService = getBackgroundService('appIdService'); -export const i18nService = getBackgroundService('i18nService'); -export const i18n2Service = getBackgroundService('i18n2Service'); -export const constantsService = getBackgroundService('constantsService'); -export const settingsService = getBackgroundService('settingsService'); -export const lockService = getBackgroundService('lockService'); -export const totpService = getBackgroundService('totpService'); -export const environmentService = getBackgroundService('environmentService'); -export const collectionService = getBackgroundService('collectionService'); -export const auditService = getBackgroundService('auditService'); diff --git a/src/popup-old/app/services/popupUtils.service.ts b/src/popup-old/app/services/popupUtils.service.ts deleted file mode 100644 index 5524afec59..0000000000 --- a/src/popup-old/app/services/popupUtils.service.ts +++ /dev/null @@ -1,120 +0,0 @@ -export class PopupUtilsService { - static initListSectionItemListeners(doc: Document, angular: any): void { - if (!doc) { - throw new Error('doc parameter required'); - } - - const sectionItems = doc.querySelectorAll( - '.list-section-item:not([data-bw-events="1"])'); - const sectionFormItems = doc.querySelectorAll( - '.list-section-item:not([data-bw-events="1"]) input, ' + - '.list-section-item:not([data-bw-events="1"]) select, ' + - '.list-section-item:not([data-bw-events="1"]) textarea'); - - sectionItems.forEach((item) => { - (item as HTMLElement).dataset.bwEvents = '1'; - - item.addEventListener('click', (e) => { - if (e.defaultPrevented) { - return; - } - - const el = e.target as HTMLElement; - - // Some elements will already focus properly - if (el.tagName != null) { - switch (el.tagName.toLowerCase()) { - case 'label': case 'input': case 'textarea': case 'select': - return; - default: - break; - } - } - - const cell = el.closest('.list-section-item'); - if (!cell) { - return; - } - - const textFilter = 'input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"])'; - const text = cell.querySelectorAll(textFilter + ', textarea'); - const checkbox = cell.querySelectorAll('input[type="checkbox"]'); - const select = cell.querySelectorAll('select'); - - if (text.length > 0) { - (text[0] as HTMLElement).focus(); - } else if (select.length > 0) { - (select[0] as HTMLElement).focus(); - } else if (checkbox.length > 0) { - const cb = checkbox[0] as HTMLInputElement; - cb.checked = !cb.checked; - if (angular) { - angular.element(checkbox[0]).triggerHandler('click'); - } - } - }, false); - }); - - sectionFormItems.forEach((item) => { - const itemCell = item.closest('.list-section-item'); - (itemCell as HTMLElement).dataset.bwEvents = '1'; - - item.addEventListener('focus', (e: Event) => { - const el = e.target as HTMLElement; - const cell = el.closest('.list-section-item'); - if (!cell) { - return; - } - - cell.classList.add('active'); - }, false); - - item.addEventListener('blur', (e: Event) => { - const el = e.target as HTMLElement; - const cell = el.closest('.list-section-item'); - if (!cell) { - return; - } - - cell.classList.remove('active'); - }, false); - }); - } - - static inSidebar(theWindow: Window): boolean { - return theWindow.location.search !== '' && theWindow.location.search.indexOf('uilocation=sidebar') > -1; - } - - static inTab(theWindow: Window): boolean { - return theWindow.location.search !== '' && theWindow.location.search.indexOf('uilocation=tab') > -1; - } - - static inPopout(theWindow: Window): boolean { - return theWindow.location.search !== '' && theWindow.location.search.indexOf('uilocation=popout') > -1; - } - - static inPopup(theWindow: Window): boolean { - return theWindow.location.search === '' || theWindow.location.search.indexOf('uilocation=') === -1 || - theWindow.location.search.indexOf('uilocation=popup') > -1; - } - - initListSectionItemListeners(doc: Document, angular: any): void { - PopupUtilsService.initListSectionItemListeners(doc, angular); - } - - inSidebar(theWindow: Window): boolean { - return PopupUtilsService.inSidebar(theWindow); - } - - inTab(theWindow: Window): boolean { - return PopupUtilsService.inTab(theWindow); - } - - inPopout(theWindow: Window): boolean { - return PopupUtilsService.inPopout(theWindow); - } - - inPopup(theWindow: Window): boolean { - return PopupUtilsService.inPopup(theWindow); - } -} diff --git a/src/popup-old/app/services/services.module.ts b/src/popup-old/app/services/services.module.ts deleted file mode 100644 index 2d1ad515ec..0000000000 --- a/src/popup-old/app/services/services.module.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as angular from 'angular'; -import * as backgroundServices from './background.service'; -import { PopupUtilsService } from './popupUtils.service'; -import { StateService } from './state.service'; -import { ValidationService } from './validation.service'; - -import { AuthService } from 'jslib/services/auth.service'; - -import BrowserMessagingService from '../../../services/browserMessaging.service'; - -const messagingService = new BrowserMessagingService(); -const authService = new AuthService(backgroundServices.cryptoService(), backgroundServices.apiService(), - backgroundServices.userService(), backgroundServices.tokenService(), backgroundServices.appIdService(), - backgroundServices.i18n2Service(), backgroundServices.platformUtilsService(), - backgroundServices.constantsService(), messagingService); - -if (backgroundServices.i18n2Service()) { - authService.init(); -} - -export default angular - .module('bit.services', ['toastr']) - .service('stateService', StateService) - .service('validationService', ValidationService) - .service('popupUtilsService', PopupUtilsService) - - .factory('authService', () => authService) - .factory('messagingService', () => messagingService) - .factory('storageService', backgroundServices.storageService) - .factory('tokenService', backgroundServices.tokenService) - .factory('cryptoService', backgroundServices.cryptoService) - .factory('userService', backgroundServices.userService) - .factory('apiService', backgroundServices.apiService) - .factory('folderService', backgroundServices.folderService) - .factory('cipherService', backgroundServices.cipherService) - .factory('syncService', backgroundServices.syncService) - .factory('autofillService', backgroundServices.autofillService) - .factory('passwordGenerationService', backgroundServices.passwordGenerationService) - .factory('platformUtilsService', backgroundServices.platformUtilsService) - .factory('utilsService', backgroundServices.utilsService) - .factory('appIdService', backgroundServices.appIdService) - .factory('i18nService', backgroundServices.i18nService) - .factory('constantsService', backgroundServices.constantsService) - .factory('settingsService', backgroundServices.settingsService) - .factory('lockService', backgroundServices.lockService) - .factory('totpService', backgroundServices.totpService) - .factory('environmentService', backgroundServices.environmentService) - .factory('collectionService', backgroundServices.collectionService) - .factory('auditService', backgroundServices.auditService) - - .name; diff --git a/src/popup-old/app/services/state.service.ts b/src/popup-old/app/services/state.service.ts deleted file mode 100644 index 76baa2d5d4..0000000000 --- a/src/popup-old/app/services/state.service.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ConstantsService } from 'jslib/services/constants.service'; - -import { StorageService } from 'jslib/abstractions/storage.service'; - -export class StateService { - private state: any = {}; - - constructor(private storageService: StorageService, private constantsService: ConstantsService) { - } - - async init() { - if (this.storageService != null) { - const iconsDisabled = await this.storageService.get(this.constantsService.disableFaviconKey); - this.saveState('faviconEnabled', !iconsDisabled); - } - } - - saveState(key: string, data: any) { - this.state[key] = data; - } - - getState(key: string): any { - if (key in this.state) { - return this.state[key]; - } - - return null; - } - - removeState(key: string) { - delete this.state[key]; - } - - purgeState() { - this.state = {}; - } -} - -StateService.$inject = ['storageService', 'constantsService']; diff --git a/src/popup-old/app/services/validation.service.ts b/src/popup-old/app/services/validation.service.ts deleted file mode 100644 index 4738b56799..0000000000 --- a/src/popup-old/app/services/validation.service.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as angular from 'angular'; - -export class ValidationService { - constructor(private toastr: any, private i18nService: any) { - } - - showError(data: any) { - const defaultErrorMessage = this.i18nService.unexpectedError; - const errors: string[] = []; - - if (!data || !angular.isObject(data)) { - errors.push(defaultErrorMessage); - } else if (!data.validationErrors) { - errors.push(data.message ? data.message : defaultErrorMessage); - } else { - for (const key in data.validationErrors) { - if (!data.validationErrors.hasOwnProperty(key)) { - continue; - } - - data.validationErrors[key].forEach((item: string) => { - errors.push(item); - }); - } - } - - if (errors.length) { - this.toastr.error(errors[0], this.i18nService.errorsOccurred); - } - - return errors; - } - -} - -ValidationService.$inject = ['toastr', 'i18nService']; diff --git a/src/popup-old/app/settings/about.component.html b/src/popup-old/app/settings/about.component.html deleted file mode 100644 index 3fcff756cb..0000000000 --- a/src/popup-old/app/settings/about.component.html +++ /dev/null @@ -1,23 +0,0 @@ -
- -
{{$ctrl.i18n.about}}
-
-
-
- bitwarden - {{$ctrl.i18n.version}} {{$ctrl.version}}
- © 8bit Solutions LLC 2015-{{$ctrl.year}} -
- -
diff --git a/src/popup-old/app/settings/about.component.ts b/src/popup-old/app/settings/about.component.ts deleted file mode 100644 index 674017d4a7..0000000000 --- a/src/popup-old/app/settings/about.component.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as template from './about.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -export class AboutController { - version: string; - year: number; - i18n: any; - - constructor(private i18nService: any) { - this.i18n = i18nService; - this.year = (new Date()).getFullYear(); - this.version = BrowserApi.getApplicationVersion(); - } -} - -AboutController.$inject = ['i18nService']; - -export const AboutComponent = { - bindings: {}, - controller: AboutController, - template: template, -}; diff --git a/src/popup-old/app/settings/credits.component.html b/src/popup-old/app/settings/credits.component.html deleted file mode 100644 index 9ed29865a5..0000000000 --- a/src/popup-old/app/settings/credits.component.html +++ /dev/null @@ -1,34 +0,0 @@ -
- -
{{$ctrl.i18n.thankYou}}
-
-
-
-
-
- {{$ctrl.i18n.translations}} -
-
-
- @sersoftin - Russian
- @lbel - Dutch
- @KarimGeiger - German
- @Primokorn - French
- @felixqu - Chinese Simplified
- @thomassth - Chinese Traditional
- @Igetin - Finnish
- @LivingWithHippos - Italian
- @King-Tut-Tut - Swedish
- @majod - Slovak
- @RixzZ - Spanish
- @SW1FT - Portuguese -
-
- -
-
-
diff --git a/src/popup-old/app/settings/credits.component.ts b/src/popup-old/app/settings/credits.component.ts deleted file mode 100644 index ad7384c2f0..0000000000 --- a/src/popup-old/app/settings/credits.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as template from './credits.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -export class CreditsController { - i18n: any; - - constructor(private i18nService: any, private $analytics: any) { - this.i18n = i18nService; - } - - learnMore() { - this.$analytics.eventTrack('Contribute Learn More'); - BrowserApi.createNewTab('https://github.com/bitwarden/browser/blob/master/CONTRIBUTING.md'); - } -} - -CreditsController.$inject = ['i18nService', '$analytics']; - -export const CreditsComponent = { - bindings: {}, - controller: CreditsController, - template: template, -}; diff --git a/src/popup-old/app/settings/environment.component.html b/src/popup-old/app/settings/environment.component.html deleted file mode 100644 index 69d697edf2..0000000000 --- a/src/popup-old/app/settings/environment.component.html +++ /dev/null @@ -1,56 +0,0 @@ -
-
- -
- -
-
{{$ctrl.i18n.settings}}
-
-
-
-
-
- {{$ctrl.i18n.selfHostedEnvironment}} -
-
-
- - -
-
- -
-
-
- {{$ctrl.i18n.customEnvironment}} -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
-
diff --git a/src/popup-old/app/settings/environment.component.ts b/src/popup-old/app/settings/environment.component.ts deleted file mode 100644 index 0465e8d342..0000000000 --- a/src/popup-old/app/settings/environment.component.ts +++ /dev/null @@ -1,60 +0,0 @@ -import * as angular from 'angular'; -import * as template from './environment.component.html'; - -import { EnvironmentService } from 'jslib/abstractions/environment.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class EnvironmentController { - iconsUrl: string; - identityUrl: string; - apiUrl: string; - webVaultUrl: string; - baseUrl: string; - i18n: any; - - constructor(private i18nService: any, private $analytics: any, private environmentService: EnvironmentService, - private toastr: any, private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - - $timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - - this.baseUrl = environmentService.baseUrl || ''; - this.webVaultUrl = environmentService.webVaultUrl || ''; - this.apiUrl = environmentService.apiUrl || ''; - this.identityUrl = environmentService.identityUrl || ''; - this.iconsUrl = environmentService.iconsUrl || ''; - } - - save() { - this.environmentService.setUrls({ - base: this.baseUrl, - api: this.apiUrl, - identity: this.identityUrl, - webVault: this.webVaultUrl, - icons: this.iconsUrl, - }).then((resUrls: any) => { - this.$timeout(() => { - // re-set urls since service can change them, ex: prefixing https:// - this.baseUrl = resUrls.base; - this.apiUrl = resUrls.api; - this.identityUrl = resUrls.identity; - this.webVaultUrl = resUrls.webVault; - this.iconsUrl = resUrls.icons; - - this.$analytics.eventTrack('Set Environment URLs'); - this.toastr.success(this.i18nService.environmentSaved); - }); - }); - } -} - -EnvironmentController.$inject = ['i18nService', '$analytics', 'environmentService', 'toastr', '$timeout']; - -export const EnvironmentComponent = { - bindings: {}, - controller: EnvironmentController, - template: template, -}; diff --git a/src/popup-old/app/settings/folders/add-folder.component.html b/src/popup-old/app/settings/folders/add-folder.component.html deleted file mode 100644 index 7793b9f5e2..0000000000 --- a/src/popup-old/app/settings/folders/add-folder.component.html +++ /dev/null @@ -1,24 +0,0 @@ -
-
- -
- - -
-
{{$ctrl.i18n.addFolder}}
-
-
-
-
-
-
- - -
-
-
-
-
-
diff --git a/src/popup-old/app/settings/folders/add-folder.component.ts b/src/popup-old/app/settings/folders/add-folder.component.ts deleted file mode 100644 index 6ba687fe5c..0000000000 --- a/src/popup-old/app/settings/folders/add-folder.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import * as angular from 'angular'; -import * as template from './add-folder.component.html'; - -import { Folder } from 'jslib/models/domain/folder'; - -import { FolderService } from 'jslib/abstractions/folder.service'; - -import { PopupUtilsService } from '../../services/popupUtils.service'; - -export class AddFolderController { - savePromise: any; - folder: {}; - i18n: any; - - constructor(private folderService: FolderService, private $state: any, private toastr: any, - private $analytics: any, private i18nService: any, $timeout: ng.ITimeoutService) { - $timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('name').focus(); - }, 500); - - this.i18n = i18nService; - this.folder = {}; - this.savePromise = null; - } - - save(model: any) { - if (!model.name) { - this.toastr.error(this.i18nService.nameRequired, this.i18nService.errorsOccurred); - return; - } - - this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => { - return this.folderService.saveWithServer(folder); - }).then(() => { - this.$analytics.eventTrack('Added Folder'); - this.toastr.success(this.i18nService.addedFolder); - this.$state.go('^.list', { animation: 'out-slide-down' }); - }); - } -} - -AddFolderController.$inject = ['folderService', '$state', 'toastr', '$analytics', 'i18nService', '$timeout']; - -export const AddFolderComponent = { - bindings: {}, - controller: AddFolderController, - template: template, -}; diff --git a/src/popup-old/app/settings/folders/edit-folder.component.html b/src/popup-old/app/settings/folders/edit-folder.component.html deleted file mode 100644 index 1d856ae1cc..0000000000 --- a/src/popup-old/app/settings/folders/edit-folder.component.html +++ /dev/null @@ -1,31 +0,0 @@ -
-
- -
- - -
-
{{$ctrl.i18n.editFolder}}
-
-
-
-
-
-
- - -
-
-
- -
-
-
diff --git a/src/popup-old/app/settings/folders/edit-folder.component.ts b/src/popup-old/app/settings/folders/edit-folder.component.ts deleted file mode 100644 index c491e3d4fa..0000000000 --- a/src/popup-old/app/settings/folders/edit-folder.component.ts +++ /dev/null @@ -1,84 +0,0 @@ -import * as angular from 'angular'; -import * as template from './edit-folder.component.html'; - -import { Folder } from 'jslib/models/domain/folder'; - -import { FolderService } from 'jslib/abstractions/folder.service'; - -import { PopupUtilsService } from '../../services/popupUtils.service'; - -export class EditFolderController { - $transition$: any; - folderId: string; - savePromise: Promise = null; - i18n: any; - folder: Folder; - - constructor($scope: any, $stateParams: any, private folderService: FolderService, private toastr: any, - private $state: any, private SweetAlert: any, private $analytics: any, private i18nService: any, - $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - - $timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('name').focus(); - }, 500); - - $scope.folder = {}; - } - - $onInit() { - this.folderId = this.$transition$.params('to').folderId; - this.folderService.get(this.folderId).then((folder: any) => { - return folder.decrypt(); - }).then((model: Folder) => { - this.folder = model; - }); - } - - save(model: any) { - if (!model.name) { - this.toastr.error(this.i18nService.nameRequired, this.i18nService.errorsOccurred); - return; - } - - this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => { - return this.folderService.saveWithServer(folder); - }).then(() => { - this.$analytics.eventTrack('Edited Folder'); - this.toastr.success(this.i18nService.editedFolder); - this.$state.go('^.list', { animation: 'out-slide-down' }); - }); - } - - delete() { - this.SweetAlert.swal({ - title: this.i18nService.deleteFolder, - text: this.i18nService.deleteFolderConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.no, - }, (confirmed: boolean) => { - if (confirmed) { - this.folderService.deleteWithServer(this.folderId).then(() => { - this.$analytics.eventTrack('Deleted Folder'); - this.toastr.success(this.i18nService.deletedFolder); - this.$state.go('^.list', { - animation: 'out-slide-down', - }); - }); - } - }); - } -} - -EditFolderController.$inject = ['$scope', '$stateParams', 'folderService', 'toastr', '$state', 'SweetAlert', - '$analytics', 'i18nService', '$timeout']; - -export const EditFolderComponent = { - bindings: { - $transition$: '<', - }, - controller: EditFolderController, - template: template, -}; diff --git a/src/popup-old/app/settings/folders/folders.component.html b/src/popup-old/app/settings/folders/folders.component.html deleted file mode 100644 index 5de3a848b1..0000000000 --- a/src/popup-old/app/settings/folders/folders.component.html +++ /dev/null @@ -1,31 +0,0 @@ -
- -
- -
-
{{$ctrl.i18n.folders}}
-
-
- -
-

- {{$ctrl.i18n.noFolders}} - {{$ctrl.i18n.addFolder}} -

-
-
- -
-
diff --git a/src/popup-old/app/settings/folders/folders.component.ts b/src/popup-old/app/settings/folders/folders.component.ts deleted file mode 100644 index 30891ec596..0000000000 --- a/src/popup-old/app/settings/folders/folders.component.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as template from './folders.component.html'; - -import { Folder } from 'jslib/models/domain/folder'; - -import { FolderService } from 'jslib/abstractions/folder.service'; - -export class FoldersController { - folders: Folder[] = []; - i18n: any; - loaded = false; - - constructor(private folderService: FolderService, private $state: any, i18nService: any) { - this.i18n = i18nService; - this.load(); - } - - load() { - this.folderService.getAllDecrypted().then((folders: any) => { - if (folders.length > 0 && folders[folders.length - 1].id === null) { - // remove the "none" folder - this.folders = folders.slice(0, folders.length - 1); - } else { - this.folders = folders; - } - - this.loaded = true; - }); - } - - editFolder(folder: any) { - this.$state.go('^.edit', { - folderId: folder.id, - animation: 'in-slide-up', - }); - } -} - -FoldersController.$inject = ['folderService', '$state', 'i18nService']; - -export const FoldersComponent = { - bindings: {}, - controller: FoldersController, - template: template, -}; diff --git a/src/popup-old/app/settings/help.component.html b/src/popup-old/app/settings/help.component.html deleted file mode 100644 index b61c3c9934..0000000000 --- a/src/popup-old/app/settings/help.component.html +++ /dev/null @@ -1,54 +0,0 @@ -
- -
{{$ctrl.i18n.helpFeedback}}
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-
diff --git a/src/popup-old/app/settings/help.component.ts b/src/popup-old/app/settings/help.component.ts deleted file mode 100644 index 4421ca81c3..0000000000 --- a/src/popup-old/app/settings/help.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as template from './help.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -export class HelpController { - i18n: any; - - constructor(private i18nService: any, private $analytics: any) { - this.i18n = i18nService; - } - - email() { - this.$analytics.eventTrack('Selected Help Email'); - BrowserApi.createNewTab('mailto:hello@bitwarden.com'); - } - - website() { - this.$analytics.eventTrack('Selected Help Website'); - BrowserApi.createNewTab('https://bitwarden.com/contact/'); - } - - tutorial() { - this.$analytics.eventTrack('Selected Help Tutorial'); - BrowserApi.createNewTab('https://bitwarden.com/browser-start/'); - } - - bug() { - this.$analytics.eventTrack('Selected Help Bug Report'); - BrowserApi.createNewTab('https://github.com/bitwarden/browser'); - } -} - -HelpController.$inject = ['i18nService', '$analytics']; - -export const HelpComponent = { - bindings: {}, - controller: HelpController, - template: template, -}; diff --git a/src/popup-old/app/settings/options.component.html b/src/popup-old/app/settings/options.component.html deleted file mode 100644 index 73938cc702..0000000000 --- a/src/popup-old/app/settings/options.component.html +++ /dev/null @@ -1,82 +0,0 @@ -
- -
{{$ctrl.i18n.options}}
-
-
-
-
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
-
diff --git a/src/popup-old/app/settings/options.component.ts b/src/popup-old/app/settings/options.component.ts deleted file mode 100644 index 9f0e13194f..0000000000 --- a/src/popup-old/app/settings/options.component.ts +++ /dev/null @@ -1,107 +0,0 @@ -import * as angular from 'angular'; -import * as template from './options.component.html'; - -import { ConstantsService } from 'jslib/services/constants.service'; - -import { MessagingService } from 'jslib/abstractions/messaging.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; -import { StorageService } from 'jslib/abstractions/storage.service'; -import { TotpService } from 'jslib/abstractions/totp.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; -import { StateService } from '../services/state.service'; - -export class OptionsController { - disableFavicon = false; - enableAutoFillOnPageLoad = false; - disableAutoTotpCopy = false; - disableContextMenuItem = false; - disableAddLoginNotification = false; - showDisableContextMenu = true; - disableGa = false; - i18n: any; - - constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService, - private platformUtilsService: PlatformUtilsService, private totpService: TotpService, - private stateService: StateService, private storageService: StorageService, - public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - this.showDisableContextMenu = !platformUtilsService.isSafari(); - - $timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - - this.loadSettings(); - } - - async loadSettings() { - this.enableAutoFillOnPageLoad = await this.storageService.get( - this.constantsService.enableAutoFillOnPageLoadKey); - - const disableGa = await this.storageService.get( - this.constantsService.disableGaKey); - this.disableGa = disableGa || (this.platformUtilsService.isFirefox() && disableGa == null); - - this.disableAddLoginNotification = await this.storageService.get( - this.constantsService.disableAddLoginNotificationKey); - - this.disableContextMenuItem = await this.storageService.get( - this.constantsService.disableContextMenuItemKey); - - this.disableAutoTotpCopy = !await this.totpService.isAutoCopyEnabled(); - - this.disableFavicon = await this.storageService.get( - this.constantsService.disableFaviconKey); - } - - callAnalytics(name: string, enabled: boolean) { - const status = enabled ? 'Enabled' : 'Disabled'; - this.$analytics.eventTrack(`${status} ${name}`); - } - - updateGa() { - this.storageService.save(this.constantsService.disableGaKey, this.disableGa); - this.callAnalytics('Analytics', !this.disableGa); - } - - updateAddLoginNotification() { - this.storageService.save(this.constantsService.disableAddLoginNotificationKey, - this.disableAddLoginNotification); - this.callAnalytics('Add Login Notification', !this.disableAddLoginNotification); - } - - updateDisableContextMenuItem() { - this.storageService.save(this.constantsService.disableContextMenuItemKey, - this.disableContextMenuItem).then(() => { - this.messagingService.send('bgUpdateContextMenu'); - }); - this.callAnalytics('Context Menu Item', !this.disableContextMenuItem); - } - - updateAutoTotpCopy() { - this.storageService.save(this.constantsService.disableAutoTotpCopyKey, this.disableAutoTotpCopy); - this.callAnalytics('Auto Copy TOTP', !this.disableAutoTotpCopy); - } - - updateAutoFillOnPageLoad() { - this.storageService.save(this.constantsService.enableAutoFillOnPageLoadKey, - this.enableAutoFillOnPageLoad); - this.callAnalytics('Auto-fill Page Load', this.enableAutoFillOnPageLoad); - } - - updateDisableFavicon() { - this.storageService.save(this.constantsService.disableFaviconKey, this.disableFavicon); - this.stateService.saveState('faviconEnabled', !this.disableFavicon); - this.callAnalytics('Favicon', !this.disableFavicon); - } -} - -OptionsController.$inject = ['i18nService', '$analytics', 'constantsService', 'platformUtilsService', 'totpService', - 'stateService', 'storageService', 'messagingService', '$timeout']; - -export const OptionsComponent = { - bindings: {}, - controller: OptionsController, - template: template, -}; diff --git a/src/popup-old/app/settings/premium.component.html b/src/popup-old/app/settings/premium.component.html deleted file mode 100644 index a53055e029..0000000000 --- a/src/popup-old/app/settings/premium.component.html +++ /dev/null @@ -1,54 +0,0 @@ -
- -
{{$ctrl.i18n.premiumMembership}}
-
-
-
-
-

{{$ctrl.i18n.premiumNotCurrentMember}}

-

{{$ctrl.i18n.premiumSignUpAndGet}}

-
    -
  • - - {{$ctrl.i18n.ppremiumSignUpStorage}} -
  • -
  • - - {{$ctrl.i18n.ppremiumSignUpTwoStep}} -
  • -
  • - - {{$ctrl.i18n.ppremiumSignUpTotp}} -
  • -
  • - - {{$ctrl.i18n.ppremiumSignUpSupport}} -
  • -
  • - - {{$ctrl.i18n.ppremiumSignUpFuture}} -
  • -
-

{{$ctrl.i18n.premiumPrice.replace('%price%', $ctrl.price)}}

- -
-
-

{{$ctrl.i18n.premiumCurrentMember}}

-

{{$ctrl.i18n.premiumCurrentMemberThanks}}

- -
-
-
diff --git a/src/popup-old/app/settings/premium.component.ts b/src/popup-old/app/settings/premium.component.ts deleted file mode 100644 index 9f24287888..0000000000 --- a/src/popup-old/app/settings/premium.component.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as template from './premium.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { ApiService } from 'jslib/abstractions/api.service'; -import { TokenService } from 'jslib/abstractions/token.service'; - -export class PremiumController { - isPremium: boolean; - i18n: any; - price = '$10'; - - constructor(private i18nService: any, private tokenService: TokenService, private apiService: ApiService, - private toastr: any, private SweetAlert: any, private $analytics: any, private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - this.isPremium = tokenService.getPremium(); - } - - refresh() { - this.apiService.refreshIdentityToken().then(() => { - this.toastr.success(this.i18nService.refreshComplete); - this.$timeout(() => { - this.isPremium = this.tokenService.getPremium(); - }); - }, (err: any) => { - this.toastr.error(this.i18nService.errorsOccurred); - }); - } - - purchase() { - this.SweetAlert.swal({ - title: this.i18nService.premiumPurchase, - text: this.i18nService.premiumPurchaseAlert, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - this.$analytics.eventTrack('Clicked Purchase Premium'); - if (confirmed) { - BrowserApi.createNewTab('https://vault.bitwarden.com/#/?premium=purchase'); - } - }); - } - - manage() { - this.SweetAlert.swal({ - title: this.i18nService.premiumManage, - text: this.i18nService.premiumManageAlert, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - this.$analytics.eventTrack('Clicked Manage Membership'); - if (confirmed) { - BrowserApi.createNewTab('https://vault.bitwarden.com/#/?premium=manage'); - } - }); - } -} - -PremiumController.$inject = ['i18nService', 'tokenService', 'apiService', 'toastr', 'SweetAlert', '$analytics', - '$timeout']; - -export const PremiumComponent = { - bindings: {}, - controller: PremiumController, - template: template, -}; diff --git a/src/popup-old/app/settings/settings.component.html b/src/popup-old/app/settings/settings.component.html deleted file mode 100644 index ea84cf559f..0000000000 --- a/src/popup-old/app/settings/settings.component.html +++ /dev/null @@ -1,101 +0,0 @@ -
- -
{{$ctrl.i18n.settings}}
-
-
-
-
-
- {{$ctrl.i18n.security}} -
-
-
- - -
- - {{$ctrl.i18n.lockNow}} - - - - {{$ctrl.i18n.twoStepLogin}} - - -
-
- - - -
-
diff --git a/src/popup-old/app/settings/settings.component.ts b/src/popup-old/app/settings/settings.component.ts deleted file mode 100644 index f6abe2bfa0..0000000000 --- a/src/popup-old/app/settings/settings.component.ts +++ /dev/null @@ -1,172 +0,0 @@ -import * as angular from 'angular'; -import * as template from './settings.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { DeviceType } from 'jslib/enums/deviceType'; - -import { ConstantsService } from 'jslib/services/constants.service'; - -import { CryptoService } from 'jslib/abstractions/crypto.service'; -import { LockService } from 'jslib/abstractions/lock.service'; -import { MessagingService } from 'jslib/abstractions/messaging.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; -import { StorageService } from 'jslib/abstractions/storage.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -const RateUrls = { - [DeviceType.Chrome]: - 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews', - [DeviceType.Firefox]: - 'https://addons.mozilla.org/en-US/firefox/addon/bitwarden-password-manager/#reviews', - [DeviceType.Opera]: - 'https://addons.opera.com/en/extensions/details/bitwarden-free-password-manager/#feedback-container', - [DeviceType.Edge]: - 'https://www.microsoft.com/store/p/bitwarden-free-password-manager/9p6kxl0svnnl', - [DeviceType.Vivaldi]: - 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews', - [DeviceType.Safari]: - 'https://itunes.apple.com/app/bitwarden-password-manager/id1137397744', -}; - -export class SettingsController { - lockOption = ''; - i18n: any; - showOnLocked: boolean; - showPopout: boolean = true; - - constructor(private $state: any, private SweetAlert: any, - private platformUtilsService: PlatformUtilsService, private $analytics: any, - private i18nService: any, private constantsService: ConstantsService, - private cryptoService: CryptoService, private lockService: LockService, - private storageService: StorageService, public messagingService: MessagingService, - private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - this.showPopout = !platformUtilsService.isSafari(); - - $timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - - this.showOnLocked = !platformUtilsService.isFirefox() && !platformUtilsService.isEdge() - && !platformUtilsService.isSafari(); - this.storageService.get(constantsService.lockOptionKey).then((lockOption: number) => { - if (lockOption != null) { - let option = lockOption.toString(); - if (option === '-2' && !this.showOnLocked) { - option = '-1'; - } - this.lockOption = option; - } else { - this.lockOption = ''; - } - }); - } - - changeLockOption() { - const option = this.lockOption && this.lockOption !== '' ? parseInt(this.lockOption, 10) : null; - this.storageService.save(this.constantsService.lockOptionKey, option).then(() => { - return this.cryptoService.getKeyHash(); - }).then((keyHash) => { - if (keyHash) { - this.cryptoService.toggleKey(); - } else { - this.SweetAlert.swal({ - title: this.i18nService.loggingOut, - text: this.i18nService.loggingOutConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - if (confirmed) { - this.cryptoService.toggleKey(); - this.messagingService.send('logout'); - } - }); - } - }); - } - - lock() { - this.$analytics.eventTrack('Lock Now'); - this.lockService.lock().then(() => { - return this.$state.go('lock', { - animation: 'in-slide-down', - }); - }); - } - - logOut() { - this.SweetAlert.swal({ - title: this.i18nService.logOut, - text: this.i18nService.logOutConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - if (confirmed) { - this.messagingService.send('logout'); - } - }); - } - - changePassword() { - this.SweetAlert.swal({ - title: this.i18nService.changeMasterPassword, - text: this.i18nService.changeMasterPasswordConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - this.$analytics.eventTrack('Clicked Change Password'); - if (confirmed) { - BrowserApi.createNewTab('https://help.bitwarden.com/article/change-your-master-password/'); - } - }); - } - - changeEmail() { - this.SweetAlert.swal({ - title: this.i18nService.changeEmail, - text: this.i18nService.changeEmailConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - this.$analytics.eventTrack('Clicked Change Email'); - if (confirmed) { - BrowserApi.createNewTab('https://help.bitwarden.com/article/change-your-email/'); - } - }); - } - - twoStep() { - this.SweetAlert.swal({ - title: this.i18nService.twoStepLogin, - text: this.i18nService.twoStepLoginConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - this.$analytics.eventTrack('Clicked Two-step Login'); - if (confirmed) { - BrowserApi.createNewTab('https://help.bitwarden.com/article/setup-two-step-login/'); - } - }); - } - - rate() { - this.$analytics.eventTrack('Rate Extension'); - BrowserApi.createNewTab((RateUrls as any)[this.platformUtilsService.getDevice()]); - } -} - -SettingsController.$inject = ['$state', 'SweetAlert', 'platformUtilsService', '$analytics', 'i18nService', - 'constantsService', 'cryptoService', 'lockService', 'storageService', 'messagingService', '$timeout']; - -export const SettingsComponent = { - bindings: {}, - controller: SettingsController, - template: template, -}; diff --git a/src/popup-old/app/settings/settings.module.ts b/src/popup-old/app/settings/settings.module.ts deleted file mode 100644 index ee9a55cc5a..0000000000 --- a/src/popup-old/app/settings/settings.module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as angular from 'angular'; -import { AboutComponent } from './about.component'; -import { CreditsComponent } from './credits.component'; -import { EnvironmentComponent } from './environment.component'; -import { AddFolderComponent } from './folders/add-folder.component'; -import { EditFolderComponent } from './folders/edit-folder.component'; -import { FoldersComponent } from './folders/folders.component'; -import { HelpComponent } from './help.component'; -import { OptionsComponent } from './options.component'; -import { PremiumComponent } from './premium.component'; -import { SettingsComponent } from './settings.component'; -import { SyncComponent } from './sync.component'; - -export default angular - .module('bit.settings', ['oitozero.ngSweetAlert', 'toastr']) - - .component('settings', SettingsComponent) - .component('environment', EnvironmentComponent) - .component('options', OptionsComponent) - .component('about', AboutComponent) - .component('credits', CreditsComponent) - .component('help', HelpComponent) - .component('folders', FoldersComponent) - .component('addFolder', AddFolderComponent) - .component('editFolder', EditFolderComponent) - .component('premium', PremiumComponent) - .component('sync', SyncComponent) - - .name; diff --git a/src/popup-old/app/settings/sync.component.html b/src/popup-old/app/settings/sync.component.html deleted file mode 100644 index bb8a135f8d..0000000000 --- a/src/popup-old/app/settings/sync.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
- -
{{$ctrl.i18n.sync}}
-
-
-
-

- - {{$ctrl.i18n.syncVaultNow}} - - {{$ctrl.i18n.lastSync}} {{$ctrl.lastSync}} - - - -

-
-
diff --git a/src/popup-old/app/settings/sync.component.ts b/src/popup-old/app/settings/sync.component.ts deleted file mode 100644 index 0ed1ab8eba..0000000000 --- a/src/popup-old/app/settings/sync.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import * as template from './sync.component.html'; - -import { SyncService } from 'jslib/abstractions/sync.service'; - -export class SyncController { - i18n: any; - lastSync = '--'; - loading = false; - - constructor(private syncService: SyncService, private toastr: any, private $analytics: any, - private i18nService: any, private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - this.setLastSync(); - } - - sync() { - this.loading = true; - this.syncService.fullSync(true).then((success: boolean) => { - this.loading = false; - if (success) { - this.setLastSync(); - this.$analytics.eventTrack('Synced Full'); - this.toastr.success(this.i18n.syncingComplete); - } else { - this.toastr.error(this.i18n.syncingFailed); - } - }); - } - - setLastSync() { - this.syncService.getLastSync().then((last: Date) => { - this.$timeout(() => { - if (last) { - this.lastSync = last.toLocaleDateString() + ' ' + last.toLocaleTimeString(); - } else { - this.lastSync = this.i18n.never; - } - }); - }); - } -} - -SyncController.$inject = ['syncService', 'toastr', '$analytics', 'i18nService', '$timeout']; - -export const SyncComponent = { - bindings: {}, - controller: SyncController, - template: template, -}; diff --git a/src/popup-old/app/tools/export.component.html b/src/popup-old/app/tools/export.component.html deleted file mode 100644 index 2dda413c53..0000000000 --- a/src/popup-old/app/tools/export.component.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
- -
- -
-
{{$ctrl.i18n.exportVault}}
-
-
-
-
-
-
- - - -
-
- -
-
-
-
diff --git a/src/popup-old/app/tools/export.component.ts b/src/popup-old/app/tools/export.component.ts deleted file mode 100644 index 3658020ef9..0000000000 --- a/src/popup-old/app/tools/export.component.ts +++ /dev/null @@ -1,174 +0,0 @@ -import * as angular from 'angular'; -import * as papa from 'papaparse'; -import * as template from './export.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { CipherType } from 'jslib/enums/cipherType'; - -import { CipherView } from 'jslib/models/view/cipherView'; -import { FolderView } from 'jslib/models/view/folderView'; - -import { CipherService } from 'jslib/abstractions/cipher.service'; -import { CryptoService } from 'jslib/abstractions/crypto.service'; -import { FolderService } from 'jslib/abstractions/folder.service'; -import { UserService } from 'jslib/abstractions/user.service'; -import { UtilsService } from 'jslib/abstractions/utils.service'; - -export class ExportController { - i18n: any; - masterPassword: string; - - constructor(private $state: any, private cryptoService: CryptoService, - private toastr: any, private utilsService: UtilsService, private $analytics: any, - private i18nService: any, private folderService: FolderService, private cipherService: CipherService, - private $window: ng.IWindowService, private userService: UserService) { - this.i18n = i18nService; - } - - $onInit() { - document.getElementById('master-password').focus(); - } - - async submit() { - if (this.masterPassword == null || this.masterPassword === '') { - this.toastr.error(this.i18nService.invalidMasterPassword, this.i18nService.errorsOccurred); - return; - } - - const email = await this.userService.getEmail(); - const key = this.cryptoService.makeKey(this.masterPassword, email); - const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key); - const storedKeyHash = await this.cryptoService.getKeyHash(); - - if (storedKeyHash != null && keyHash != null && storedKeyHash === keyHash) { - const csv = await this.getCsv(); - this.$analytics.eventTrack('Exported Data'); - this.downloadFile(csv); - this.$state.go('tabs.tools', { animation: 'out-slide-down' }); - } else { - this.toastr.error(this.i18n.invalidMasterPassword, this.i18n.errorsOccurred); - } - } - - private async checkPassword() { - const email = await this.userService.getEmail(); - const key = this.cryptoService.makeKey(this.masterPassword, email); - const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key); - const storedKeyHash = await this.cryptoService.getKeyHash(); - if (storedKeyHash == null || keyHash == null || storedKeyHash !== keyHash) { - throw new Error('Invalid password.'); - } - } - - private async getCsv(): Promise { - let decFolders: FolderView[] = []; - let decCiphers: CipherView[] = []; - const promises = []; - - promises.push(this.folderService.getAllDecrypted().then((folders) => { - decFolders = folders; - })); - - promises.push(this.cipherService.getAllDecrypted().then((ciphers) => { - decCiphers = ciphers; - })); - - await Promise.all(promises); - - const foldersMap = new Map(); - decFolders.forEach((f) => { - foldersMap.set(f.id, f); - }); - - const exportCiphers: any[] = []; - decCiphers.forEach((c) => { - // only export logins and secure notes - if (c.type !== CipherType.Login && c.type !== CipherType.SecureNote) { - return; - } - - const cipher: any = { - folder: c.folderId && foldersMap.has(c.folderId) ? foldersMap.get(c.folderId).name : null, - favorite: c.favorite ? 1 : null, - type: null, - name: c.name, - notes: c.notes, - fields: null, - // Login props - login_uri: null, - login_username: null, - login_password: null, - login_totp: null, - }; - - if (c.fields) { - c.fields.forEach((f: any) => { - if (!cipher.fields) { - cipher.fields = ''; - } else { - cipher.fields += '\n'; - } - - cipher.fields += ((f.name || '') + ': ' + f.value); - }); - } - - switch (c.type) { - case CipherType.Login: - cipher.type = 'login'; - cipher.login_username = c.login.username; - cipher.login_password = c.login.password; - cipher.login_totp = c.login.totp; - - if (c.login.uris) { - cipher.login_uri = []; - c.login.uris.forEach((u) => { - cipher.login_uri.push(u.uri); - }); - } - break; - case CipherType.SecureNote: - cipher.type = 'note'; - break; - default: - return; - } - - exportCiphers.push(cipher); - }); - - const csv = papa.unparse(exportCiphers); - return csv; - } - - private downloadFile(csv: string): void { - const fileName = this.makeFileName(); - BrowserApi.downloadFile(this.$window, csv, { type: 'text/plain' }, fileName); - } - - private makeFileName(): string { - const now = new Date(); - const dateString = - now.getFullYear() + '' + this.padNumber(now.getMonth() + 1, 2) + '' + this.padNumber(now.getDate(), 2) + - this.padNumber(now.getHours(), 2) + '' + this.padNumber(now.getMinutes(), 2) + - this.padNumber(now.getSeconds(), 2); - - return 'bitwarden_export_' + dateString + '.csv'; - } - - private padNumber(num: number, width: number, padCharacter: string = '0'): string { - const numString = num.toString(); - return numString.length >= width ? numString : - new Array(width - numString.length + 1).join(padCharacter) + numString; - } -} - -ExportController.$inject = ['$state', 'cryptoService', 'toastr', 'utilsService', '$analytics', 'i18nService', - 'folderService', 'cipherService', '$window', 'userService']; - -export const ExportComponent = { - bindings: {}, - controller: ExportController, - template: template, -}; diff --git a/src/popup-old/app/tools/password-generator-history.component.html b/src/popup-old/app/tools/password-generator-history.component.html deleted file mode 100644 index 0508627b5a..0000000000 --- a/src/popup-old/app/tools/password-generator-history.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
- - -
{{$ctrl.i18n.passwordHistory}}
-
-
-
-
-
-
- - - -
- - {{item.password}} - - {{item.date | date: 'medium'}} -
-
-
-
- -
-
diff --git a/src/popup-old/app/tools/password-generator-history.component.ts b/src/popup-old/app/tools/password-generator-history.component.ts deleted file mode 100644 index 38abdcf39f..0000000000 --- a/src/popup-old/app/tools/password-generator-history.component.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as template from './password-generator-history.component.html'; - -import { PasswordHistory } from 'jslib/models/domain/passwordHistory'; - -import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; - -export class PasswordGeneratorHistoryController { - $transition$: any; - history: PasswordHistory[]; - editState: any; - addState: any; - i18n: any; - loaded: boolean = false; - - constructor(private $state: any, private passwordGenerationService: PasswordGenerationService, - private toastr: any, private $analytics: any, private i18nService: any) { - this.i18n = i18nService; - - passwordGenerationService.getHistory().then((history) => { - this.history = history; - this.loaded = true; - }); - } - - $onInit() { - const params = this.$transition$.params('to'); - this.addState = params.addState; - this.editState = params.editState; - } - - clear() { - this.history = []; - this.passwordGenerationService.clear(); - } - - clipboardError(e: any, password: any) { - this.toastr.info(this.i18nService.browserNotSupportClipboard); - } - - clipboardSuccess(e: any) { - this.$analytics.eventTrack('Copied Historical Password'); - e.clearSelection(); - this.toastr.info(this.i18nService.passwordCopied); - } - - close() { - this.$state.go('^.passwordGenerator', { - animation: 'out-slide-right', - addState: this.addState, - editState: this.editState, - }); - } -} - -PasswordGeneratorHistoryController.$inject = ['$state', 'passwordGenerationService', 'toastr', '$analytics', - 'i18nService']; - -export const PasswordGeneratorHistoryComponent = { - bindings: { - $transition$: '<', - }, - controller: PasswordGeneratorHistoryController, - template: template, -}; diff --git a/src/popup-old/app/tools/password-generator.component.html b/src/popup-old/app/tools/password-generator.component.html deleted file mode 100644 index 31539adb2a..0000000000 --- a/src/popup-old/app/tools/password-generator.component.html +++ /dev/null @@ -1,90 +0,0 @@ -
- - -
{{$ctrl.i18n.generatePassword}}
-
-
-
- {{$ctrl.password}} -
-
- -
-
- {{$ctrl.i18n.options}} -
-
-
- - {{$ctrl.options.length}} -
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
-
-
- - -
-
- - -
-
-
-
-
-
- - -
-
-
-
-
diff --git a/src/popup-old/app/tools/password-generator.component.ts b/src/popup-old/app/tools/password-generator.component.ts deleted file mode 100644 index e665c2a28d..0000000000 --- a/src/popup-old/app/tools/password-generator.component.ts +++ /dev/null @@ -1,147 +0,0 @@ -import * as angular from 'angular'; -import * as template from './password-generator.component.html'; - -import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; - -import { PopupUtilsService } from '../services/popupUtils.service'; - -export class PasswordGeneratorController { - $transition$: any; - options: any; - showSelect: boolean; - password: string = '-'; - editState: any; - addState: any; - i18n: any; - - constructor(private $state: any, private passwordGenerationService: PasswordGenerationService, - private toastr: any, private $analytics: any, private i18nService: any, private $timeout: ng.ITimeoutService) { - this.i18n = i18nService; - - passwordGenerationService.getOptions().then((options: any) => { - this.options = options; - this.regenerate(false); - $analytics.eventTrack('Generated Password'); - passwordGenerationService.addHistory(this.password); - }); - - // Save password once the slider stop moving. - document.querySelector('#length').addEventListener('change', (e) => { - e.preventDefault(); - - $analytics.eventTrack('Generated Password'); - this.saveOptions(this.options, false); - passwordGenerationService.addHistory(this.password); - }); - } - - $onInit() { - const params = this.$transition$.params('to'); - this.addState = params.addState; - this.editState = params.editState; - - this.showSelect = this.addState || this.editState; - - this.$timeout(() => { - PopupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - } - - sliderMoved() { - this.regenerate(false); - } - - regenerate(trackEvent: any) { - this.password = this.passwordGenerationService.generatePassword(this.options); - - if (trackEvent) { - this.$analytics.eventTrack('Regenerated Password'); - this.passwordGenerationService.addHistory(this.password); - } - } - - saveOptions(options: any, regenerate: boolean = true) { - if (!options.uppercase && !options.lowercase && !options.number && !options.special) { - options.lowercase = this.options.lowercase = true; - } - if (!options.minNumber) { - options.minNumber = this.options.minNumber = 0; - } - if (!options.minSpecial) { - options.minSpecial = this.options.minSpecial = 0; - } - - this.passwordGenerationService.saveOptions(options); - if (regenerate) { - this.regenerate(false); - } - return true; - } - - clipboardError(e: any, password: any) { - this.toastr.info(this.i18nService.browserNotSupportClipboard); - } - - clipboardSuccess(e: any) { - this.$analytics.eventTrack('Copied Generated Password'); - e.clearSelection(); - this.toastr.info(this.i18nService.passwordCopied); - } - - close() { - this.dismiss(); - } - - select() { - this.$analytics.eventTrack('Selected Generated Password'); - - if (this.addState) { - this.addState.cipher.login.password = this.password; - } else if (this.editState) { - this.editState.cipher.login.password = this.password; - } - - this.dismiss(); - } - - goHistory() { - this.$state.go('^.passwordGeneratorHistory', { - animation: 'in-slide-left', - addState: this.addState, - editState: this.editState, - }); - } - - private dismiss() { - if (this.addState) { - this.$state.go('addCipher', { - animation: 'out-slide-down', - from: this.addState.from, - cipher: this.addState.cipher, - }); - } else if (this.editState) { - this.$state.go('editCipher', { - animation: 'out-slide-down', - cipher: this.editState.cipher, - fromView: this.editState.fromView, - cipherId: this.editState.cipherId, - from: this.editState.from, - }); - } else { - this.$state.go('tabs.tools', { - animation: 'out-slide-down', - }); - } - } -} - -PasswordGeneratorController.$inject = ['$state', 'passwordGenerationService', 'toastr', '$analytics', 'i18nService', - '$timeout']; - -export const PasswordGeneratorComponent = { - bindings: { - $transition$: '<', - }, - controller: PasswordGeneratorController, - template: template, -}; diff --git a/src/popup-old/app/tools/tools.component.html b/src/popup-old/app/tools/tools.component.html deleted file mode 100644 index dbf6017c19..0000000000 --- a/src/popup-old/app/tools/tools.component.html +++ /dev/null @@ -1,47 +0,0 @@ -
- -
{{$ctrl.i18n.tools}}
-
- diff --git a/src/popup-old/app/tools/tools.component.ts b/src/popup-old/app/tools/tools.component.ts deleted file mode 100644 index 3279408af6..0000000000 --- a/src/popup-old/app/tools/tools.component.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as template from './tools.component.html'; - -import { BrowserApi } from '../../../browser/browserApi'; - -import { EnvironmentService } from 'jslib/abstractions/environment.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; - -export class ToolsController { - showExport: boolean; - showPopout: boolean = true; - i18n: any; - private webVaultBaseUrl: string = 'https://vault.bitwarden.com'; - - constructor(private SweetAlert: any, private i18nService: any, private $analytics: any, - private platformUtilsService: PlatformUtilsService, private environmentService: EnvironmentService) { - this.i18n = i18nService; - this.showExport = !platformUtilsService.isEdge(); - this.showPopout = !platformUtilsService.isSafari(); - if (environmentService.baseUrl) { - this.webVaultBaseUrl = environmentService.baseUrl; - } else if (environmentService.webVaultUrl) { - this.webVaultBaseUrl = environmentService.webVaultUrl; - } - } - - launchWebVault(createOrg: any) { - this.$analytics.eventTrack('Launch Web Vault' + (createOrg ? ' For Share' : '')); - BrowserApi.createNewTab(this.webVaultBaseUrl + '/#/' + (createOrg ? '?org=free' : '')); - } - - launchAndroid() { - this.$analytics.eventTrack('Launch Android'); - BrowserApi.createNewTab('https://play.google.com/store/apps/details?id=com.x8bit.bitwarden'); - } - - launchiOS() { - this.$analytics.eventTrack('Launch iOS'); - BrowserApi.createNewTab('https://itunes.apple.com/us/app/bitwarden-free-password-manager/' + - 'id1137397744?mt=8'); - } - - launchImport() { - this.SweetAlert.swal({ - title: this.i18nService.importItems, - text: this.i18nService.importItemsConfirmation, - showCancelButton: true, - confirmButtonText: this.i18nService.yes, - cancelButtonText: this.i18nService.cancel, - }, (confirmed: boolean) => { - if (confirmed) { - this.$analytics.eventTrack('Launch Web Vault For Import'); - BrowserApi.createNewTab('https://help.bitwarden.com/article/import-data/'); - } - }); - } -} - -ToolsController.$inject = ['SweetAlert', 'i18nService', '$analytics', 'platformUtilsService', 'environmentService']; - -export const ToolsComponent = { - bindings: {}, - controller: ToolsController, - template: template, -}; diff --git a/src/popup-old/app/tools/tools.module.ts b/src/popup-old/app/tools/tools.module.ts deleted file mode 100644 index 49821bbb73..0000000000 --- a/src/popup-old/app/tools/tools.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as angular from 'angular'; -import { ExportComponent } from './export.component'; -import { PasswordGeneratorHistoryComponent } from './password-generator-history.component'; -import { PasswordGeneratorComponent } from './password-generator.component'; -import { ToolsComponent } from './tools.component'; - -export default angular - .module('bit.tools', ['ngAnimate', 'ngclipboard', 'toastr', 'oitozero.ngSweetAlert']) - - .component('tools', ToolsComponent) - .component('passwordGeneratorHistory', PasswordGeneratorHistoryComponent) - .component('passwordGenerator', PasswordGeneratorComponent) - .component('export', ExportComponent) - - .name; diff --git a/src/popup-old/app/vault/vaultAddCipherController.js b/src/popup-old/app/vault/vaultAddCipherController.js deleted file mode 100644 index f2b2175a1e..0000000000 --- a/src/popup-old/app/vault/vaultAddCipherController.js +++ /dev/null @@ -1,196 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultAddCipherController', function ($scope, $state, $stateParams, cipherService, folderService, - cryptoService, toastr, popupUtilsService, $analytics, i18nService, constantsService, $timeout, auditService) { - $scope.i18n = i18nService; - $scope.constants = constantsService; - $scope.addFieldType = constantsService.fieldType.text.toString(); - $scope.selectedType = constantsService.cipherType.login.toString(); - var from = $stateParams.from, - folderId = $stateParams.folderId && $stateParams.folderId !== '0' ? $stateParams.folderId : null; - - $scope.cipher = { - folderId: folderId, - name: $stateParams.name, - type: constantsService.cipherType.login, - login: { - uris: [{ - uri: null, - match: null, - matchValue: null - }] - }, - identity: {}, - card: {}, - secureNote: { - type: 0 // generic note - } - }; - - if ($stateParams.uri) { - $scope.cipher.login.uris[0].uri = $stateParams.uri; - } - - if ($stateParams.cipher) { - angular.extend($scope.cipher, $stateParams.cipher); - } - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - - if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) { - document.getElementById('loginUsername').focus(); - } - else { - document.getElementById('name').focus(); - } - }, 500); - - folderService.getAllDecrypted().then(function (folders) { - $scope.folders = folders; - }); - - $scope.typeChanged = function () { - $scope.cipher.type = parseInt($scope.selectedType); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.savePromise = null; - $scope.save = function () { - if (!$scope.cipher.name || $scope.cipher.name === '') { - toastr.error(i18nService.nameRequired, i18nService.errorsOccurred); - return; - } - - $scope.savePromise = cipherService.encrypt($scope.cipher).then(function (cipherModel) { - var cipher = new Cipher(cipherModel, true); - return cipherService.saveWithServer(cipher); - }).then(function (c) { - $analytics.eventTrack('Added Cipher'); - toastr.success(i18nService.addedItem); - $scope.close(); - }); - }; - - $scope.close = function () { - if (from === 'current') { - $state.go('tabs.current', { - animation: 'out-slide-down' - }); - } - else if (from === 'grouping') { - $state.go('viewGrouping', { - animation: 'out-slide-down' - }); - } - else { - $state.go('tabs.vault', { - animation: 'out-slide-down' - }); - } - }; - - $scope.showPassword = false; - $scope.togglePassword = function () { - $analytics.eventTrack('Toggled Password'); - $scope.showPassword = !$scope.showPassword; - }; - - $scope.checkPassword = function () { - if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') { - return; - } - - $analytics.eventTrack('Check Password'); - auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) { - if (matches != 0) { - toastr.error(i18nService.passwordExposed); - } else { - toastr.success(i18nService.passwordSafe); - } - }); - }; - - $scope.addUri = function () { - if (!$scope.cipher.login) { - return; - } - - if (!$scope.cipher.login.uris) { - $scope.cipher.login.uris = []; - } - - $scope.cipher.login.uris.push({ - uri: null, - match: null, - matchValue: null - }); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.removeUri = function (uri) { - if (!$scope.cipher.login || !$scope.cipher.login.uris) { - return; - } - - var index = $scope.cipher.login.uris.indexOf(uri); - if (index > -1) { - $scope.cipher.login.uris.splice(index, 1); - } - }; - - $scope.uriMatchChanged = function (uri) { - uri.showOptions = uri.showOptions == null ? true : uri.showOptions; - if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') { - uri.match = null; - } - else { - uri.match = parseInt(uri.matchValue); - } - }; - - $scope.toggleUriOptions = function (u) { - u.showOptions = u.showOptions == null && u.match != null ? false : !u.showOptions; - }; - - $scope.addField = function (type) { - if (!$scope.cipher.fields) { - $scope.cipher.fields = []; - } - - $scope.cipher.fields.push({ - type: parseInt(type), - name: null, - value: null - }); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.removeField = function (field) { - var index = $scope.cipher.fields.indexOf(field); - if (index > -1) { - $scope.cipher.fields.splice(index, 1); - } - }; - - $scope.generatePassword = function () { - $analytics.eventTrack('Clicked Generate Password'); - $state.go('passwordGenerator', { - animation: 'in-slide-up', - addState: { - from: from, - cipher: $scope.cipher - } - }); - }; - }); diff --git a/src/popup-old/app/vault/vaultAttachmentsController.js b/src/popup-old/app/vault/vaultAttachmentsController.js deleted file mode 100644 index 463d262fa2..0000000000 --- a/src/popup-old/app/vault/vaultAttachmentsController.js +++ /dev/null @@ -1,127 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultAttachmentsController', function ($scope, $state, $stateParams, cipherService, toastr, - SweetAlert, popupUtilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - - $scope.i18n = i18nService; - $scope.isPremium = tokenService.getPremium(); - $scope.canAccessAttachments = $scope.isPremium; - $scope.hasUpdatedKey = false; - - cipherService.get($stateParams.id).then(function (cipher) { - return cipher.decrypt(); - }).then(function (model) { - $scope.cipher = model; - $scope.canAccessAttachments = $scope.isPremium || !!$scope.cipher.organizationId; - - if (!$scope.canAccessAttachments) { - SweetAlert.swal({ - title: i18nService.premiumRequired, - text: i18nService.premiumRequiredDesc, - showCancelButton: true, - confirmButtonText: i18nService.learnMore, - cancelButtonText: i18nService.cancel - }, function (confirmed) { - if (confirmed) { - BrowserApi.createNewTab('https://vault.bitwarden.com/#/?premium=purchase'); - } - }); - return; - } - else { - cryptoService.getEncKey().then(function (key) { - $scope.hasUpdatedKey = !!key; - if (!$scope.hasUpdatedKey) { - SweetAlert.swal({ - title: i18nService.featureUnavailable, - text: i18nService.updateKey, - showCancelButton: true, - confirmButtonText: i18nService.learnMore, - cancelButtonText: i18nService.cancel - }, function (confirmed) { - if (confirmed) { - BrowserApi.createNewTab('https://help.bitwarden.com/article/update-encryption-key/'); - } - }); - } - }); - } - }); - - $scope.submitPromise = null; - $scope.submit = function () { - if (!$scope.hasUpdatedKey) { - toastr.error(i18nService.updateKey); - return; - } - - var fileEl = document.getElementById('file'); - var files = fileEl.files; - if (!files || !files.length) { - toastr.error(i18nService.selectFile, i18nService.errorsOccurred); - return; - } - - if (files[0].size > 104857600) { // 100 MB - toastr.error(i18nService.maxFileSize, i18nService.errorsOccurred); - return deferred.promise; - } - - $scope.submitPromise = cipherService.saveAttachmentWithServer($scope.cipher, files[0]).then(function (cipher) { - cipher.decrypt().then(function (model) { - $scope.cipher = model; - }); - $analytics.eventTrack('Added Attachment'); - toastr.success(i18nService.attachmentSaved); - - // reset file input - // ref: https://stackoverflow.com/a/20552042 - fileEl.type = ''; - fileEl.type = 'file'; - fileEl.value = ''; - }, function (err) { - if (err) { - toastr.error(err); - } - else { - toastr.error(i18nService.errorsOccurred); - } - }); - }; - - $scope.delete = function (attachment) { - SweetAlert.swal({ - title: i18nService.deleteAttachment, - text: i18nService.deleteAttachmentConfirmation, - showCancelButton: true, - confirmButtonText: i18nService.yes, - cancelButtonText: i18nService.no - }, function (confirmed) { - if (confirmed) { - cipherService.deleteAttachmentWithServer($stateParams.id, attachment.id).then(function () { - var index = $scope.cipher.attachments.indexOf(attachment); - if (index > -1) { - $scope.cipher.attachments.splice(index, 1); - } - $analytics.eventTrack('Deleted Attachment'); - toastr.success(i18nService.deletedAttachment); - }); - } - }); - }; - - $scope.close = function () { - $state.go('editCipher', { - cipherId: $stateParams.id, - animation: 'out-slide-down', - from: $stateParams.from, - fromView: $stateParams.fromView - }); - - return; - }; - }); diff --git a/src/popup-old/app/vault/vaultController.js b/src/popup-old/app/vault/vaultController.js deleted file mode 100644 index 28c5e4aaf6..0000000000 --- a/src/popup-old/app/vault/vaultController.js +++ /dev/null @@ -1,246 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultController', function ($scope, $rootScope, cipherService, folderService, $q, $state, $stateParams, toastr, - syncService, platformUtilsService, $analytics, i18nService, stateService, $timeout, $window, collectionService, $filter) { - var stateKey = 'vault', - state = stateService.getState(stateKey) || {}; - stateService.removeState('viewGrouping'); - - $scope.i18n = i18nService; - $scope.showGroupingCounts = !platformUtilsService.isEdge(); - $scope.disableSearch = platformUtilsService.isEdge(); - $scope.showPopout = !platformUtilsService.isSafari(); - document.getElementById('search').focus(); - - var syncOnLoad = $stateParams.syncOnLoad; - if (syncOnLoad) { - $scope.$on('$viewContentLoaded', function () { - $timeout(function () { - syncService.fullSync(true); - }, 0); - }); - } - - var delayLoad = true; - $scope.loaded = true; - if (!$rootScope.vaultCiphers) { - $rootScope.vaultCiphers = []; - $scope.favoriteCiphers = []; - delayLoad = false; - } - else { - $scope.favoriteCiphers = $filter('filter')($rootScope.vaultCiphers, { favorite: true }); - - if (!$rootScope.vaultCollections || !$rootScope.vaultCollections.length) { - $scope.noFolderCiphers = $filter('filter')($rootScope.vaultCiphers, { folderId: null }); - if ($scope.noFolderCiphers.length >= 100) { - $scope.noFolderCiphers = null; - } - } - } - - if (!$rootScope.vaultFolders) { - $rootScope.vaultFolders = []; - delayLoad = false; - $scope.loaded = false; - } - - if (!$rootScope.vaultCollections) { - $rootScope.vaultCollections = []; - delayLoad = false; - $scope.loaded = false; - } - - if (delayLoad) { - $timeout(setScrollY, 100); - $timeout(loadVault, 1000); - } - else if (!syncOnLoad) { - loadVault(); - } - - function loadVault() { - var decFolders = []; - var decCollections = []; - var decCiphers = []; - - var folderPromise = folderService.getAllDecrypted().then(function (folders) { - decFolders = folders; - }); - - var collectionPromise = collectionService.getAllDecrypted().then(function (collections) { - decCollections = collections; - }); - - var cipherPromise = cipherService.getAllDecrypted().then(function (ciphers) { - decCiphers = ciphers; - }); - - $q.all([folderPromise, collectionPromise, cipherPromise]).then(function () { - $scope.loaded = true; - $rootScope.vaultFolders = decFolders; - $rootScope.vaultCollections = decCollections; - $rootScope.vaultCiphers = decCiphers; - $scope.favoriteCiphers = $filter('filter')($rootScope.vaultCiphers, { favorite: true }); - - if (!$rootScope.vaultCollections || !$rootScope.vaultCollections.length) { - $scope.noFolderCiphers = $filter('filter')($rootScope.vaultCiphers, { folderId: null }); - if ($scope.noFolderCiphers.length >= 100) { - $scope.noFolderCiphers = null; - } - - if ($scope.noFolderCiphers && $rootScope.vaultFolders && $rootScope.vaultFolders.length && - !$rootScope.vaultFolders[$rootScope.vaultFolders.length - 1].id) { - $rootScope.vaultFolders = $rootScope.vaultFolders.slice(0, $rootScope.vaultFolders.length - 1); - } - } - - if ($scope.showGroupingCounts) { - var folderCounts = { 'none': 0 }; - var collectionCounts = {}; - - decCiphers.forEach((cipher) => { - if (cipher.folderId) { - if (!folderCounts.hasOwnProperty(cipher.folderId)) { - folderCounts[cipher.folderId] = 0; - } - folderCounts[cipher.folderId]++; - } - else { - folderCounts.none++; - } - - if (cipher.collectionIds) { - cipher.collectionIds.forEach((collectionId) => { - if (!collectionCounts.hasOwnProperty(collectionId)) { - collectionCounts[collectionId] = 0; - } - collectionCounts[collectionId]++; - }); - } - }); - - $rootScope.vaultFolders.forEach((folder) => { - folder.itemCount = folderCounts[folder.id || 'none'] || 0; - }); - - $rootScope.vaultCollections.forEach((collection) => { - collection.itemCount = collectionCounts[collection.id] || 0; - }); - } - - if (!delayLoad) { - setScrollY(); - } - }); - } - - $scope.searchText = null; - if (state.searchText || $stateParams.searchText) { - $scope.searchText = state.searchText || $stateParams.searchText; - } - - $scope.searchCiphers = function () { - if (!$scope.searchText || $scope.searchText.length < 2) { - return; - } - - return searchCipher; - }; - - function searchCipher(cipher) { - var searchTerm = $scope.searchText.toLowerCase(); - if (cipher.name && cipher.name.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - if (cipher.subTitle && cipher.subTitle.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - if (cipher.login && cipher.login.uri && cipher.login.uri.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - - return false; - } - - $scope.addCipher = function () { - storeState(); - $state.go('addCipher', { - animation: 'in-slide-up', - from: 'vault' - }); - }; - - $scope.viewCipher = function (cipher) { - var canLaunch = cipher.login && cipher.login.uri && - (cipher.login.uri.startsWith('http://') || cipher.login.uri.startsWith('https://')); - if (canLaunch && cipher.clicked) { - cipher.cancelClick = true; - cipher.clicked = false; - $scope.launchWebsite(cipher); - return; - } - - cipher.clicked = true; - cipher.cancelClick = false; - - $timeout(function () { - if (cipher.cancelClick) { - cipher.cancelClick = false; - cipher.clicked = false; - return; - } - - storeState(); - $state.go('viewCipher', { - cipherId: cipher.id, - animation: 'in-slide-up', - from: 'vault' - }); - - // clean up - cipher.cancelClick = false; - cipher.clicked = false; - }, 200); - }; - - $scope.launchWebsite = function (cipher) { - if (cipher.login && cipher.login.uri) { - $analytics.eventTrack('Launched Website'); - BrowserApi.createNewTab(cipher.login.uri); - } - }; - - $scope.viewGrouping = function (grouping, folder) { - storeState(); - $state.go('viewGrouping', { - folderId: (folder && grouping.id) || '0', - collectionId: (!folder && grouping.id) || '0', - animation: 'in-slide-left' - }); - }; - - $scope.$on('syncCompleted', function (event, successfully) { - $timeout(loadVault, 500); - }); - - function storeState() { - stateService.saveState(stateKey, { - scrollY: getScrollY(), - searchText: $scope.searchText - }); - } - - function getScrollY() { - var content = document.getElementsByClassName('content')[0]; - return content.scrollTop; - } - - function setScrollY() { - if (state.scrollY) { - var content = document.getElementsByClassName('content')[0]; - content.scrollTop = state.scrollY; - } - } - }); diff --git a/src/popup-old/app/vault/vaultEditCipherController.js b/src/popup-old/app/vault/vaultEditCipherController.js deleted file mode 100644 index 29279d99e6..0000000000 --- a/src/popup-old/app/vault/vaultEditCipherController.js +++ /dev/null @@ -1,242 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultEditCipherController', function ($scope, $state, $stateParams, cipherService, folderService, - cryptoService, toastr, SweetAlert, platformUtilsService, $analytics, i18nService, constantsService, $timeout, - popupUtilsService, auditService) { - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - document.getElementById('name').focus(); - }, 500); - - $scope.i18n = i18nService; - $scope.constants = constantsService; - $scope.showAttachments = !platformUtilsService.isEdge(); - $scope.addFieldType = constantsService.fieldType.text.toString(); - $scope.selectedType = constantsService.cipherType.login.toString(); - var cipherId = $stateParams.cipherId; - var fromView = $stateParams.fromView; - var from = $stateParams.from; - - $scope.cipher = { - folderId: null - }; - - if ($stateParams.cipher) { - angular.extend($scope.cipher, $stateParams.cipher); - setUriMatchValues(); - } - else { - cipherService.get(cipherId).then(function (cipher) { - return cipher.decrypt(); - }).then(function (model) { - $scope.cipher = model; - setUriMatchValues(); - }); - } - - folderService.getAllDecrypted().then(function (folders) { - $scope.folders = folders; - }); - - $scope.typeChanged = function () { - $scope.cipher.type = parseInt($scope.selectedType); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.savePromise = null; - $scope.save = function () { - if (!$scope.cipher.name || $scope.cipher.name === '') { - toastr.error(i18nService.nameRequired, i18nService.errorsOccurred); - return; - } - - $scope.savePromise = cipherService.encrypt($scope.cipher).then(function (cipherModel) { - var cipher = new Cipher(cipherModel, true); - return cipherService.saveWithServer(cipher).then(function (c) { - $analytics.eventTrack('Edited Cipher'); - toastr.success(i18nService.editedItem); - $scope.close(); - }); - }); - }; - - $scope.delete = function () { - SweetAlert.swal({ - title: i18nService.deleteItem, - text: i18nService.deleteItemConfirmation, - showCancelButton: true, - confirmButtonText: i18nService.yes, - cancelButtonText: i18nService.no - }, function (confirmed) { - if (confirmed) { - cipherService.deleteWithServer(cipherId).then(function () { - $analytics.eventTrack('Deleted Cipher'); - toastr.success(i18nService.deletedItem); - $state.go('tabs.vault', { - animation: 'out-slide-down' - }); - }); - } - }); - }; - - $scope.attachments = function () { - $state.go('attachments', { - id: cipherId, - animation: 'in-slide-up', - from: from, - fromView: fromView - }); - }; - - $scope.close = function () { - if (fromView) { - $state.go('viewCipher', { - cipherId: cipherId, - animation: 'out-slide-down', - from: from - }); - } - else { - $state.go('tabs.vault', { - animation: 'out-slide-down' - }); - } - }; - - $scope.showPassword = false; - $scope.togglePassword = function () { - $analytics.eventTrack('Toggled Password'); - $scope.showPassword = !$scope.showPassword; - }; - - $scope.checkPassword = function () { - if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') { - return; - } - - $analytics.eventTrack('Check Password'); - auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) { - if (matches != 0) { - toastr.error(i18nService.passwordExposed); - } else { - toastr.success(i18nService.passwordSafe); - } - }); - }; - - $scope.addUri = function () { - if (!$scope.cipher.login) { - return; - } - - if (!$scope.cipher.login.uris) { - $scope.cipher.login.uris = []; - } - - $scope.cipher.login.uris.push({ - uri: null, - match: null, - matchValue: null - }); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.removeUri = function (uri) { - if (!$scope.cipher.login || !$scope.cipher.login.uris) { - return; - } - - var index = $scope.cipher.login.uris.indexOf(uri); - if (index > -1) { - $scope.cipher.login.uris.splice(index, 1); - } - }; - - $scope.uriMatchChanged = function (uri) { - uri.showOptions = uri.showOptions == null ? true : uri.showOptions; - if ((!uri.matchValue && uri.matchValue !== 0) || uri.matchValue === '') { - uri.match = null; - } - else { - uri.match = parseInt(uri.matchValue); - } - }; - - $scope.toggleUriOptions = function (u) { - u.showOptions = u.showOptions == null && u.match != null ? false : !u.showOptions; - }; - - $scope.addField = function (type) { - if (!$scope.cipher.fields) { - $scope.cipher.fields = []; - } - - $scope.cipher.fields.push({ - type: parseInt(type), - name: null, - value: null - }); - - $timeout(function () { - popupUtilsService.initListSectionItemListeners(document, angular); - }, 500); - }; - - $scope.removeField = function (field) { - var index = $scope.cipher.fields.indexOf(field); - if (index > -1) { - $scope.cipher.fields.splice(index, 1); - } - }; - - $scope.generatePassword = function () { - if ($scope.cipher.login.password) { - SweetAlert.swal({ - title: i18nService.overwritePassword, - text: i18nService.overwritePasswordConfirmation, - showCancelButton: true, - confirmButtonText: i18nService.yes, - cancelButtonText: i18nService.no - }, function (confirmed) { - if (confirmed) { - goPasswordGenerator(); - } - }); - } - else { - goPasswordGenerator(); - } - - }; - - function goPasswordGenerator() { - $analytics.eventTrack('Clicked Generate Password'); - $state.go('passwordGenerator', { - animation: 'in-slide-up', - editState: { - fromView: fromView, - cipherId: cipherId, - cipher: $scope.cipher, - from: from - } - }); - } - - function setUriMatchValues() { - if ($scope.cipher.login && $scope.cipher.login.uris) { - for (var i = 0; i < $scope.cipher.login.uris.length; i++) { - $scope.cipher.login.uris[i].matchValue = - $scope.cipher.login.uris[i].match || $scope.cipher.login.uris[i].match === 0 ? - $scope.cipher.login.uris[i].match.toString() : ''; - } - } - } - }); diff --git a/src/popup-old/app/vault/vaultModule.js b/src/popup-old/app/vault/vaultModule.js deleted file mode 100644 index f10fe2e9a8..0000000000 --- a/src/popup-old/app/vault/vaultModule.js +++ /dev/null @@ -1,2 +0,0 @@ -angular - .module('bit.vault', ['ngAnimate', 'toastr', 'ngclipboard', 'oitozero.ngSweetAlert', 'infinite-scroll']); diff --git a/src/popup-old/app/vault/vaultViewCipherController.js b/src/popup-old/app/vault/vaultViewCipherController.js deleted file mode 100644 index 40c53da470..0000000000 --- a/src/popup-old/app/vault/vaultViewCipherController.js +++ /dev/null @@ -1,216 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr, - $analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService, - SweetAlert, constantsService, auditService) { - $scope.constants = constantsService; - $scope.i18n = i18nService; - $scope.showAttachments = !platformUtilsService.isEdge(); - var from = $stateParams.from, - totpInterval = null; - - $scope.isPremium = tokenService.getPremium(); - $scope.cipher = null; - var cipherObj = null; - cipherService.get($stateParams.cipherId).then(function (cipher) { - if (!cipher) { - return; - } - - cipherObj = cipher; - return cipher.decrypt(); - }).then(function (model) { - $timeout(function () { - $scope.cipher = model; - if (model.login && model.login.totp && (cipherObj.organizationUseTotp || tokenService.getPremium())) { - totpUpdateCode(); - totpTick(); - - if (totpInterval) { - clearInterval(totpInterval); - } - - totpInterval = setInterval(function () { - totpTick(); - }, 1000); - } - }); - }); - - $scope.edit = function (cipher) { - $state.go('editCipher', { - animation: 'in-slide-up', - cipherId: cipher.id, - fromView: true, - from: from - }); - }; - - $scope.toggleFieldValue = function (field) { - field.showValue = !field.showValue; - }; - - $scope.close = function () { - if (from === 'current') { - $state.go('tabs.current', { - animation: 'out-slide-down' - }); - } - else if (from === 'grouping') { - $state.go('viewGrouping', { - animation: 'out-slide-down' - }); - } - else { - $state.go('tabs.vault', { - animation: 'out-slide-down' - }); - } - }; - - $scope.launch = function (uri) { - if (!uri.canLaunch) { - return; - } - - $analytics.eventTrack('Launched Login URI'); - BrowserApi.createNewTab(uri.uri); - }; - - $scope.clipboardError = function (e, password) { - toastr.info(i18n.browserNotSupportClipboard); - }; - - $scope.clipboardSuccess = function (e, type, aType) { - e.clearSelection(); - $analytics.eventTrack('Copied ' + aType); - toastr.info(type + i18nService.valueCopied); - }; - - $scope.showPassword = false; - $scope.togglePassword = function () { - $analytics.eventTrack('Toggled Password'); - $scope.showPassword = !$scope.showPassword; - }; - - $scope.download = function (attachment) { - if (!$scope.cipher.organizationId && !tokenService.getPremium()) { - SweetAlert.swal({ - title: i18nService.premiumRequired, - text: i18nService.premiumRequiredDesc, - showCancelButton: true, - confirmButtonText: i18nService.learnMore, - cancelButtonText: i18nService.cancel - }, function (confirmed) { - if (confirmed) { - BrowserApi.createNewTab('https://bitwarden.com'); - } - }); - return; - } - - if (attachment.downloading) { - return; - } - - attachment.downloading = true; - var req = new XMLHttpRequest(); - req.open('GET', attachment.url, true); - req.responseType = 'arraybuffer'; - req.onload = function (evt) { - if (!req.response) { - toastr.error(i18n.errorsOccurred); - $timeout(function () { - attachment.downloading = false; - }); - return; - } - - cryptoService.getOrgKey($scope.cipher.organizationId).then(function (key) { - return cryptoService.decryptFromBytes(req.response, key); - }).then(function (decBuf) { - BrowserApi.downloadFile($window, decBuf, null, attachment.fileName); - - $timeout(function () { - attachment.downloading = false; - }); - }, function () { - toastr.error(i18n.errorsOccurred); - $timeout(function () { - attachment.downloading = false; - }); - }); - }; - req.send(null); - }; - - $scope.$on("$destroy", function () { - if (totpInterval) { - clearInterval(totpInterval); - } - }); - - $scope.formatYear = function (year) { - if (year.length == 2) { - return '20' + year; - } - - return year; - }; - - $scope.maskValue = function (value) { - return value ? '••••••••' : null; - }; - - function totpUpdateCode() { - if ($scope.cipher.type !== constantsService.cipherType.login || !$scope.cipher.login.totp) { - return; - } - - totpService.getCode($scope.cipher.login.totp).then(function (code) { - $timeout(function () { - if (code) { - $scope.totpCodeFormatted = code.substring(0, 3) + ' ' + code.substring(3); - $scope.totpCode = code; - } - else { - $scope.totpCode = $scope.totpCodeFormatted = null; - if (totpInterval) { - clearInterval(totpInterval); - } - } - }); - }); - } - - $scope.checkPassword = function () { - if (!$scope.cipher.login || !$scope.cipher.login.password || $scope.cipher.login.password === '') { - return; - } - - $analytics.eventTrack('Check Password'); - auditService.passwordLeaked($scope.cipher.login.password).then(function (matches) { - if (matches != 0) { - toastr.error(i18nService.passwordExposed); - } else { - toastr.success(i18nService.passwordSafe); - } - }); - }; - - function totpTick() { - $timeout(function () { - var epoch = Math.round(new Date().getTime() / 1000.0); - var mod = epoch % 30; - var sec = 30 - mod; - - $scope.totpSec = sec; - $scope.totpDash = (2.62 * mod).toFixed(2); - $scope.totpLow = sec <= 7; - if (mod === 0) { - totpUpdateCode(); - } - }); - } - }); diff --git a/src/popup-old/app/vault/vaultViewGroupingController.js b/src/popup-old/app/vault/vaultViewGroupingController.js deleted file mode 100644 index 33d7f534df..0000000000 --- a/src/popup-old/app/vault/vaultViewGroupingController.js +++ /dev/null @@ -1,243 +0,0 @@ -angular - .module('bit.vault') - - .controller('vaultViewGroupingController', function ($scope, cipherService, folderService, $q, $state, $stateParams, toastr, - syncService, $analytics, i18nService, stateService, platformUtilsService, $timeout, $window, collectionService) { - var stateKey = 'viewGrouping', - state = stateService.getState(stateKey) || {}; - - state.folderId = $stateParams.folderId || state.folderId; - state.collectionId = $stateParams.collectionId || state.collectionId; - - var pageSize = 100, - decGrouping = null, - decCiphers = []; - - $scope.grouping = { - id: null, - name: i18nService.noneFolder - }; - $scope.folderGrouping = true; - $scope.collectionGrouping = false; - - if (state.folderId && state.folderId !== '0') { - $scope.grouping.id = state.folderId; - } - else if (state.collectionId && state.collectionId !== '0') { - $scope.grouping.id = state.collectionId; - $scope.folderGrouping = false; - $scope.collectionGrouping = true; - } - - $scope.i18n = i18nService; - document.getElementById('search').focus(); - - $scope.loaded = false; - $scope.vaultCiphers = []; - $scope.pagedVaultCiphers = []; - $scope.searchText = null; - loadVault(); - - function loadVault() { - var promises = []; - - if ($scope.grouping.id && $scope.folderGrouping) { - var getFolderPromise = folderService.get($scope.grouping.id).then(function (folder) { - return folder.decrypt(); - }).then(function (model) { - decGrouping = model; - }); - promises.push(getFolderPromise); - } - else if ($scope.grouping.id && $scope.collectionGrouping) { - var getCollectionPromise = collectionService.get($scope.grouping.id).then(function (collection) { - return collection.decrypt(); - }).then(function (model) { - decGrouping = model; - }); - promises.push(getCollectionPromise); - } - - var cipherPromise = cipherService.getAllDecryptedForGrouping($scope.grouping.id, $scope.folderGrouping) - .then(function (ciphers) { - if (platformUtilsService.isEdge()) { - // Edge is super slow at sorting - decCiphers = ciphers; - } - else { - decCiphers = ciphers.sort(cipherSort); - } - }); - promises.push(cipherPromise); - - $q.all(promises).then(function () { - $scope.loaded = true; - $scope.vaultCiphers = decCiphers; - - if (decGrouping) { - $scope.grouping.name = decGrouping.name; - } - - if (state.searchText) { - $scope.searchText = state.searchText; - $scope.searchCiphers(); - } - - $timeout(setScrollY, 200); - }); - } - - function cipherSort(a, b) { - if (!a.name) { - return -1; - } - if (!b.name) { - return 1; - } - - var aName = a.name.toLowerCase(), - bName = b.name.toLowerCase(); - if (aName > bName) { - return 1; - } - if (aName < bName) { - return -1; - } - - if (!a.subTitle) { - return -1; - } - if (!b.subTitle) { - return 1; - } - - var aSubTitle = a.subTitle.toLowerCase(), - bSubTitle = b.subTitle.toLowerCase(); - if (aSubTitle > bSubTitle) { - return 1; - } - if (aSubTitle < bSubTitle) { - return -1; - } - - // a must be equal to b - return 0; - } - - $scope.loadMore = function () { - var pagedLength = $scope.pagedVaultCiphers.length; - if ($scope.vaultCiphers.length > pagedLength) { - $scope.pagedVaultCiphers = - $scope.pagedVaultCiphers.concat($scope.vaultCiphers.slice(pagedLength, pagedLength + pageSize)); - } - }; - - $scope.searchCiphers = function () { - if (!$scope.searchText || $scope.searchText.length < 2) { - if ($scope.vaultCiphers.length !== decCiphers.length) { - resetList(decCiphers); - } - return; - } - - var matchedCiphers = []; - for (var i = 0; i < decCiphers.length; i++) { - if (searchCipher(decCiphers[i])) { - matchedCiphers.push(decCiphers[i]); - } - } - - resetList(matchedCiphers); - }; - - function resetList(ciphers) { - $scope.vaultCiphers = ciphers; - $scope.pagedVaultCiphers = []; - $scope.loadMore(); - } - - function searchCipher(cipher) { - var searchTerm = $scope.searchText.toLowerCase(); - if (cipher.name && cipher.name.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - if (cipher.subTitle && cipher.subTitle.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - if (cipher.login && cipher.login.uri && cipher.login.uri.toLowerCase().indexOf(searchTerm) !== -1) { - return true; - } - - return false; - } - - $scope.addCipher = function () { - storeState(); - $state.go('addCipher', { - animation: 'in-slide-up', - from: 'grouping', - folderId: state.folderId - }); - }; - - $scope.viewCipher = function (cipher) { - var canLaunch = cipher.login && cipher.login.uri && - (cipher.login.uri.startsWith('http://') || cipher.login.uri.startsWith('https://')); - if (canLaunch && cipher.clicked) { - cipher.cancelClick = true; - cipher.clicked = false; - $scope.launchWebsite(cipher); - return; - } - - cipher.clicked = true; - cipher.cancelClick = false; - - $timeout(function () { - if (cipher.cancelClick) { - cipher.cancelClick = false; - cipher.clicked = false; - return; - } - - storeState(); - $state.go('viewCipher', { - cipherId: cipher.id, - animation: 'in-slide-up', - from: 'grouping' - }); - - // clean up - cipher.cancelClick = false; - cipher.clicked = false; - }, 200); - }; - - $scope.launchWebsite = function (cipher) { - if (cipher.login && cipher.login.uri) { - $analytics.eventTrack('Launched Website'); - BrowserApi.createNewTab(cipher.login.uri); - } - }; - - function storeState() { - angular.extend(state, { - scrollY: getScrollY(), - searchText: $scope.searchText - }); - - stateService.saveState(stateKey, state); - } - - function getScrollY() { - var content = document.getElementsByClassName('content')[0]; - return content.scrollTop; - } - - function setScrollY() { - if (state.scrollY) { - var content = document.getElementsByClassName('content')[0]; - content.scrollTop = state.scrollY; - } - } - }); diff --git a/src/popup-old/app/vault/views/vault.html b/src/popup-old/app/vault/views/vault.html deleted file mode 100644 index e9acdb8e91..0000000000 --- a/src/popup-old/app/vault/views/vault.html +++ /dev/null @@ -1,128 +0,0 @@ - -
- -
-
-
-
- {{::i18n.favorites}} - {{favoriteCiphers.length}} -
- -
-
-
- {{::i18n.folders}} - {{vaultFolders.length}} -
- -
-
-
- {{::i18n.collections}} - {{vaultCollections.length}} -
- -
-
-
- {{::i18n.noneFolder}} - {{noFolderCiphers.length}} -
- -
-
-
- - -
-

- {{i18n.noItemsInList}} - -

-
-
- -
-
diff --git a/src/popup-old/app/vault/views/vaultAddCipher.html b/src/popup-old/app/vault/views/vaultAddCipher.html deleted file mode 100644 index 558798ca19..0000000000 --- a/src/popup-old/app/vault/views/vaultAddCipher.html +++ /dev/null @@ -1,306 +0,0 @@ -
-
- -
- - -
-
{{i18n.addItem}}
-
-
-
-
-
- {{i18n.itemInformation}} -
-
-
- - -
-
- - -
-
-
- - -
-
-
- - -
- -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
-
-
-
-
-
- - - -
- - - - -
- - - -
- - {{i18n.newUri}} - -
-
-
-
-
- - -
-
- - -
-
-
-
-
- -
-
-
- -
-
-
-
-
- {{i18n.customFields}} -
-
-
- - - -
- - - - -
-
-
- - {{i18n.newCustomField}} - - -
-
-
-
-
-
diff --git a/src/popup-old/app/vault/views/vaultAttachments.html b/src/popup-old/app/vault/views/vaultAttachments.html deleted file mode 100644 index a4c0d1371e..0000000000 --- a/src/popup-old/app/vault/views/vaultAttachments.html +++ /dev/null @@ -1,47 +0,0 @@ -
-
- -
- - -
-
{{i18n.attachments}}
-
-
-
-
-
-
- {{i18n.noAttachments}} -
-
-
- - - -
- {{attachment.sizeName}} - {{attachment.fileName}} -
-
-
-
-
- {{i18n.newAttachment}} -
-
-
- - -
-
- -
-
-
-
diff --git a/src/popup-old/app/vault/views/vaultEditCipher.html b/src/popup-old/app/vault/views/vaultEditCipher.html deleted file mode 100644 index 98b36ef7d7..0000000000 --- a/src/popup-old/app/vault/views/vaultEditCipher.html +++ /dev/null @@ -1,310 +0,0 @@ -
-
- -
- - -
-
{{i18n.editItem}}
-
-
-
-
-
- {{i18n.itemInformation}} - -
-
-
- - -
- -
-
- - -
-
-
- - -
- -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- -
-
-
-
-
-
- - - -
- - - - -
- - - -
- - {{i18n.newUri}} - -
-
-
-
-
- - -
-
- - -
- - {{i18n.attachments}} - - -
-
-
-
- -
-
-
- -
-
-
-
-
- {{i18n.customFields}} -
-
-
- - - -
- - - - -
-
-
- - {{i18n.newCustomField}} - - -
-
-
- -
-
-
diff --git a/src/popup-old/app/vault/views/vaultViewCipher.html b/src/popup-old/app/vault/views/vaultViewCipher.html deleted file mode 100644 index 82ff3baa87..0000000000 --- a/src/popup-old/app/vault/views/vaultViewCipher.html +++ /dev/null @@ -1,251 +0,0 @@ -
- - -
{{i18n.viewItem}}
-
-
-
-
-
- {{i18n.itemInformation}} - -
-
-
- {{i18n.name}} - {{cipher.name}} -
-
-
-
- - - -
- {{i18n.username}} - {{cipher.login.username}} -
-
- - {{i18n.password}} - {{maskValue(cipher.login.password)}} - {{cipher.login.password}} -
-
-
- - - -
- - {{totpSec}} - - - - - - - - {{i18n.verificationCodeTotp}} - {{totpCodeFormatted}} - -
-
-
-
- {{i18n.cardholderName}} - {{cipher.card.cardholderName}} -
-
-
- - - -
- {{i18n.number}} - {{cipher.card.number}} -
-
- {{i18n.brand}} - {{cipher.card.brand}} -
-
- {{i18n.expiration}} - {{cipher.card.expMonth ? ('0' + cipher.card.expMonth).slice(-2) : '__'}} - / - {{cipher.card.expYear ? formatYear(cipher.card.expYear) : '____'}} -
-
-
- - - -
- {{i18n.securityCode}} - {{cipher.card.code}} -
-
-
-
- {{i18n.identityName}} - {{cipher.identity.title}} - {{cipher.identity.firstName}} - {{cipher.identity.middleName}} - {{cipher.identity.lastName}} -
-
- {{i18n.username}} - {{cipher.identity.username}} -
-
- {{i18n.company}} - {{cipher.identity.company}} -
-
- {{i18n.ssn}} - {{cipher.identity.ssn}} -
-
- {{i18n.passportNumber}} - {{cipher.identity.passportNumber}} -
-
- {{i18n.licenseNumber}} - {{cipher.identity.licenseNumber}} -
-
- {{i18n.email}} - {{cipher.identity.email}} -
-
- {{i18n.phone}} - {{cipher.identity.phone}} -
-
- {{i18n.address}} -
{{cipher.identity.address1}}
-
{{cipher.identity.address2}}
-
{{cipher.identity.address3}}
-
- {{cipher.identity.city || '-'}}, - {{cipher.identity.state || '-'}}, - {{cipher.identity.postalCode || '-'}} -
-
{{cipher.identity.country}}
-
-
-
- -
-
-
-
-
-
- - {{i18n.website}} - {{i18n.uri}} - {{u.domainOrUri}} -
-
-
-
-
- {{i18n.notes}} -
-
-
{{cipher.notes}}
-
-
-
-
- {{i18n.customFields}} -
-
-
- - {{field.name}} -
- {{field.value || ' '}} -
-
- {{maskValue(field.value)}} - {{field.value}} -
-
- - -
-
-
-
- -
-
diff --git a/src/popup-old/app/vault/views/vaultViewGrouping.html b/src/popup-old/app/vault/views/vaultViewGrouping.html deleted file mode 100644 index 81310d6335..0000000000 --- a/src/popup-old/app/vault/views/vaultViewGrouping.html +++ /dev/null @@ -1,50 +0,0 @@ - -
-
-
-
-
- {{grouping.name}} - {{vaultCiphers.length}} -
- - - - - {{cipher.name}} - - - - {{cipher.subTitle}} - -
-
-
-
-

- {{i18n.noItemsInList}} - -

-
-
- -
-
diff --git a/src/popup-old/images/loading.svg b/src/popup-old/images/loading.svg deleted file mode 100644 index 7076310516..0000000000 --- a/src/popup-old/images/loading.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - Loading... - - diff --git a/src/popup-old/images/logo.png b/src/popup-old/images/logo.png deleted file mode 100644 index 33ced5b12e..0000000000 Binary files a/src/popup-old/images/logo.png and /dev/null differ diff --git a/src/popup-old/images/logo@2x.png b/src/popup-old/images/logo@2x.png deleted file mode 100644 index 2a0ba60b9b..0000000000 Binary files a/src/popup-old/images/logo@2x.png and /dev/null differ diff --git a/src/popup-old/images/logo@3x.png b/src/popup-old/images/logo@3x.png deleted file mode 100644 index 9047316769..0000000000 Binary files a/src/popup-old/images/logo@3x.png and /dev/null differ diff --git a/src/popup-old/images/u2fkey.jpg b/src/popup-old/images/u2fkey.jpg deleted file mode 100644 index 8013df0e56..0000000000 Binary files a/src/popup-old/images/u2fkey.jpg and /dev/null differ diff --git a/src/popup-old/images/yubikey.jpg b/src/popup-old/images/yubikey.jpg deleted file mode 100644 index 9ddf755dec..0000000000 Binary files a/src/popup-old/images/yubikey.jpg and /dev/null differ diff --git a/src/popup-old/index.html b/src/popup-old/index.html deleted file mode 100644 index 27d50b53df..0000000000 --- a/src/popup-old/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Bitwarden - - -
- - diff --git a/src/popup-old/less/animations.less b/src/popup-old/less/animations.less deleted file mode 100644 index 0d7fbca717..0000000000 --- a/src/popup-old/less/animations.less +++ /dev/null @@ -1,132 +0,0 @@ -@import (reference) "variables.less"; - -.in-slide-up { - .main-view.ng-enter, - .main-view.ng-leave { - -webkit-transition: all 0.4s ease; - transition: all 0.4s ease; - } - - .main-view.ng-enter { - top: 100%; - z-index: 990; - } - - .main-view.ng-enter.ng-enter-active { - top: 0; - } - - .main-view.ng-leave { - top: 0; - z-index: 970; - } - - .main-view.ng-leave.ng-leave-active { - top: 0; - } -} - -.in-slide-down { - .main-view.ng-enter, - .main-view.ng-leave { - -webkit-transition: all 0.4s ease; - transition: all 0.4s ease; - } - - .main-view.ng-enter { - bottom: 100%; - z-index: 990; - .box-shadow(0 4px 2px -2px gray); - } - - .main-view.ng-enter.ng-enter-active { - bottom: 0; - } - - .main-view.ng-leave { - top: 0; - z-index: 970; - } - - .main-view.ng-leave.ng-leave-active { - top: 0; - } -} - -.out-slide-down { - .main-view.ng-enter, - .main-view.ng-leave { - -webkit-transition: all 0.4s ease; - transition: all 0.4s ease; - } - - .main-view.ng-enter { - top: 0; - z-index: 970; - } - - .main-view.ng-enter.ng-enter-active { - top: 0; - } - - .main-view.ng-leave { - top: 0; - z-index: 990; - } - - .main-view.ng-leave.ng-leave-active { - top: 100%; - } -} - -.in-slide-left { - .main-view.ng-enter, - .main-view.ng-leave { - -webkit-transition: all 0.4s ease; - transition: all 0.4s ease; - } - - .main-view.ng-enter { - left: 100%; - z-index: 970; - } - - .main-view.ng-enter.ng-enter-active { - left: 0; - } - - .main-view.ng-leave { - left: 0; - z-index: 990; - } - - .main-view.ng-leave.ng-leave-active { - left: -100%; - } -} - -.out-slide-right { - .main-view.ng-enter, - .main-view.ng-leave { - -webkit-transition: all 0.4s ease; - transition: all 0.4s ease; - } - - .main-view.ng-enter { - right: 100%; - z-index: 970; - } - - .main-view.ng-enter.ng-enter-active { - right: 0; - } - - .main-view.ng-leave { - right: 0; - z-index: 990; - } - - .main-view.ng-leave.ng-leave-active { - right: -100%; - } -} diff --git a/src/popup-old/less/components.less b/src/popup-old/less/components.less deleted file mode 100644 index 1b10677429..0000000000 --- a/src/popup-old/less/components.less +++ /dev/null @@ -1,664 +0,0 @@ -@import (reference) "variables.less"; -@import (reference) "mixins.less"; - -.header { - min-height: 44px; - max-height: 44px; - background-color: @brand-primary; - color: white; - text-align: center; - position: absolute; - top: 0; - left: 0; - right: 0; - overflow: hidden; - - a, button { - color: white !important; - text-decoration: none; - background: none; - - &:hover, &:focus { - background-color: rgba(255, 255, 255, 0.1); - } - - &:hover { - text-decoration: none; - } - - &:focus { - text-decoration: underline; - } - } - - .title { - font-weight: bold; - display: block; - padding: 12px 0; - text-align: center; - } - - .left { - display: block; - position: absolute; - left: 0; - text-align: left; - - a, button { - padding: 12px 10px; - display: block; - float: left; - } - - .fa-spinner { - padding: 15px; - display: block; - float: left; - } - - .fa-external-link { - vertical-align: 0; - margin: 0 -5px 0 5px; - } - } - - .right { - display: block; - right: 0; - position: absolute; - z-index: 99999; - - a, button { - padding: 12px 10px; - display: block; - float: right; - } - - .fa-spinner { - padding: 15px; - display: block; - float: right; - } - } - - &.header-search { - .left, .right, .search { - display: table-cell; - position: relative; - } - - .search { - padding: 0 7px; - width: 100%; - text-align: left; - position: relative; - - .fa-search { - position: absolute; - top: 15px; - left: 15px; - color: lighten(@brand-primary, 30%); - } - - input { - width: 100%; - margin: 0; - float: none; - background: darken(@brand-primary, 8%); - border: none; - color: white; - padding: 5px 10px 5px 30px; - border-radius: 5px; - .placeholder-color(lighten(@brand-primary, 35%)); - - &:focus { - border-radius: 5px; - outline: none; - background: darken(@brand-primary, 10%); - } - } - } - - a { - white-space: nowrap; - float: none; - } - } -} - -.tabs { - width: 100%; - height: 55px; - background-color: white; - border-top: 1px solid @border-color-dark; - position: absolute; - bottom: 0; - left: 0; - right: 0; - overflow: hidden; - - ul { - width: 100%; - list-style: none; - padding: 0; - margin: 0; - - li { - width: 25%; - float: left; - display: inline-block; - padding: 0; - margin: 0; - - a { - text-align: center; - display: block; - padding: 7px 0; - text-decoration: none; - color: @gray-light; - font-size: 12px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - &:hover, &:focus { - background-color: @list-item-hover; - } - - i { - display: block; - margin-bottom: 2px; - text-align: center; - } - } - - &.active { - a { - color: @brand-primary; - } - } - } - } -} - -.list { - .list-grouped { - .list-grouped-header { - background-color: transparent; - padding: 10px 10px; - color: @gray-light; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - small { - float: right; - } - } - } - - .list-section { - padding-bottom: 10px; - - &:first-child { - padding-top: 10px; - } - - .list-section-header { - background-color: transparent; - padding: 5px 10px; - color: @gray-light; - text-transform: uppercase; - font-size: (@font-size-base - 1); - - label { - font-weight: normal; - } - - span { - float: right; - } - } - - .list-section-items { - border-top: 1px solid @border-color-dark; - border-bottom: 1px solid @border-color-dark; - } - - .list-section-footer { - padding: 5px 10px; - font-size: @font-size-small; - color: @gray-light; - } - } - - .list-grouped-item, .list-section-item { - display: block; - padding: 10px 10px; - background-color: white; - text-decoration: none; - color: @text-color; - position: relative; - z-index: 1; - - &:not(.pre) { - &:after { - content: ""; - display: table; - clear: both; - } - } - - &.pre { - white-space: pre; - overflow-x: auto; - } - - &.text-primary { - color: @brand-primary !important; - } - - &.text-danger { - color: @brand-danger !important; - } - - &:not(.wrap) { - .text, .detail { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } - - &:before { - content: ""; - position: absolute; - right: 0; - bottom: 0; - height: 1px; - width: ~"calc(100% - 10px)"; - border-bottom: 1px solid @border-color; - } - - &:last-child { - &:before { - border: none; - height: 0; - } - } - - &:hover, &:focus, &.active { - background-color: @list-item-hover; - } - - &:not(:hover):focus { - border-left: 5px solid @brand-primary; - padding-left: 5px; - } - - .leading-icon { - font-size: 35px; - float: left; - display: inline-block; - margin: 0 8px 5px 0; - } - - .text { - display: block; - color: @text-color; - } - - .detail { - font-size: @font-size-small; - color: @gray-light; - display: block; - } - - .item-label { - font-size: @font-size-small; - color: @gray-light; - display: block; - width: 100%; - font-weight: normal; - margin-bottom: 5px; - } - - &.list-section-item-table { - display: table; - width: 100%; - } - - .action-button { - padding: 8px 8px 8px 4px; - display: table-cell; - width: 20px; - vertical-align: middle; - - &.text-danger { - color: @brand-danger !important; - } - } - - .action-button-content { - display: table-cell; - vertical-align: middle; - - input + label.sr-only + select { - margin-top: 5px; - } - } - - .action-button-content + .action-button { - padding: 8px 0 8px 14px; - } - - .field-type { - margin: 5px 0 0 27px; - width: ~"calc(100% - 27px)"; - } - - .icon { - display: flex; - justify-content: center; - align-items: center; - float: left; - height: 36px; - width: 34px; - margin-left: -5px; - color: @text-muted; - - img { - border-radius: 3px; - max-height: 20px; - max-width: 20px; - } - - &.single-line { - height: initial; - display: block; - text-align: center; - } - } - - .action-buttons { - float: right; - - .btn-list { - float: left; - cursor: pointer; - padding: 10px 8px; - background: none; - border: none; - color: @brand-primary; - - &:hover, &:focus { - color: darken(@brand-primary, 10%); - } - - &.disabled { - color: @list-icon-color; - - &:hover { - color: @list-icon-color; - } - } - - &:last-child { - padding-right: 2px !important; - } - } - } - - .fa-chevron-right, .right-icon { - float: right; - margin-top: 4px; - color: @list-icon-color; - } - - .item-sub-label { - float: right; - display: block; - margin-right: 15px; - color: @gray-light; - } - - small.item-sub-label { - margin-top: 2px; - } - - &.condensed { - padding: 3px 10px; - - .action-buttons { - .btn-list { - padding: 8px 5px; - } - } - - &:not(:hover):focus { - padding-left: 5px; - } - } - - &.wrap { - overflow-wrap: break-word; - } - - &.flex { - display: flex; - } - - .flex-grow { - flex-grow: 1; - } - - input:not([type="checkbox"]), select, textarea { - border: none; - width: 100%; - background-color: transparent; - .placeholder-color(#bbbbbb); - - &:focus { - outline: none; - } - } - - &.list-section-item-checkbox, &.list-section-item-input, &.list-section-item-slider { - label, .item-label { - font-size: @font-size-base; - color: @text-color; - display: inline; - width: initial; - font-weight: normal; - float: left; - margin: 0; - } - } - - &.list-section-item-checkbox { - input[type="checkbox"] { - float: right; - display: inline-block; - } - } - - &.list-section-item-input { - input { - float: right; - display: inline-block; - border: none; - background: none; - width: 55px; - text-align: right; - } - } - - &.list-section-item-slider { - .slider-value { - color: @gray-light; - text-align: right; - min-width: 45px; - } - - > * { - display: table-cell !important; - vertical-align: middle; - } - - input { - width: 100%; - margin: 0; - } - - .slider-wrapper { - width: 100%; - padding: 0 0 0 20px; - max-width: 500px; - } - } - - &.list-section-item-icon-input { - padding: 15px 15px; - - .fa { - float: left; - color: @list-icon-color; - margin-top: 3px; - } - - input { - display: inline-block; - margin-left: 10px; - float: left; - width: ~"calc(100% - 40px)"; - } - } - } -} - -.list-no-selection { - .list-grouped-item:not(.list-allow-selection), .list-section-item:not(.list-allow-selection) { - &:hover { - background-color: white; - } - } -} - -.no-animation { - &.ng-hide.ng-hide-animate, &.ng-leave { - display: none !important; - } -} - -.no-padding { - padding: 0 !important; -} - -.no-margin { - margin: 0 !important; -} - -.btn { - border-radius: 0; - -webkit-border-radius: 0; - -moz-border-radius: 0; -} - -.btn-link { - color: @brand-primary-accent; -} - -.text-accent { - color: @brand-primary-accent; -} - -.page-loading { - .fa-spinner { - position: fixed; - top: 50%; - left: 50%; - color: @gray-light; - margin-left: -5px; - margin-top: -15px; - } -} - -.centered-message { - p { - position: absolute; - top: 50%; - margin-top: -70px; - display: block; - text-align: center; - padding: 0 10px; - width: 100%; - } -} - -#duoFrameWrapper { - background: ~"url('../images/loading.svg') 0 0 no-repeat"; - width: 100%; - height: 470px; - margin-bottom: -10px; - - iframe { - width: 100%; - height: 100%; - border: none; - } -} - -.totp { - .totp-code { - font-family: @font-family-monospace; - font-size: 1.1em; - } - - .totp-countdown { - margin: 3px 3px 0 0; - display: block; - user-select: none; - float: right; - - .totp-sec { - font-size: 0.85em; - position: absolute; - line-height: 32px; - width: 32px; - text-align: center; - } - - svg { - width: 32px; - height: 32px; - transform: rotate(-90deg); - } - - .totp-circle { - stroke: @brand-primary; - fill: none; - - &.inner { - stroke-width: 3; - stroke-dasharray: 78.6; - stroke-dashoffset: 0px; - } - - &.outer { - stroke-width: 2; - stroke-dasharray: 88; - stroke-dashoffset: 0px; - } - } - } - - &.low { - .totp-sec, .totp-code { - color: @brand-danger; - } - - .totp-circle { - stroke: @brand-danger; - } - } -} diff --git a/src/popup-old/less/libs.less b/src/popup-old/less/libs.less deleted file mode 100644 index 22cfea5473..0000000000 --- a/src/popup-old/less/libs.less +++ /dev/null @@ -1,4 +0,0 @@ -@import "~font-awesome/less/font-awesome.less"; -@import "~angular-toastr/src/toastr.less"; -@import (inline) "~sweetalert/dist/sweetalert.css"; - diff --git a/src/popup-old/less/mixins.less b/src/popup-old/less/mixins.less deleted file mode 100644 index fa888edf95..0000000000 --- a/src/popup-old/less/mixins.less +++ /dev/null @@ -1,19 +0,0 @@ -.placeholder-color(@color) { - &:-moz-placeholder { - color: @color; - opacity: 1; - } - - &::-moz-placeholder { - color: @color; - opacity: 1; - } - - &:-ms-input-placeholder { - color: @color; - } - - &::-webkit-input-placeholder { - color: @color; - } -} diff --git a/src/popup-old/less/pages.less b/src/popup-old/less/pages.less deleted file mode 100644 index e6d097cd47..0000000000 --- a/src/popup-old/less/pages.less +++ /dev/null @@ -1,166 +0,0 @@ -@import (reference) "variables.less"; -@import (reference) "mixins.less"; - -.generate-password-block { - margin: 20px; - font-size: 19px; - text-align: center; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - font-family: @font-family-monospace; -} - -.about-page { - padding: 50px 0 20px; - text-align: center; - - img { - margin: 0 auto 20px; - width: 270px; - display: block; - } - - p { - text-align: inherit; - } -} - -.home-page { - padding: 150px 20px 20px; - text-align: center; - position: relative; - height: 100%; - - img { - margin: 0 auto 30px; - width: 250px; - display: block; - } - - p { - font-size: 18px; - text-align: inherit; - } - - a.settings-icon { - color: #bbbbbb; - position: absolute; - top: 10px; - left: 10px; - - span { - visibility: hidden; - } - - &:hover { - color: @link-hover-color; - text-decoration: none; - - span { - visibility: visible; - } - } - } -} - -.splash-page { - text-align: center; - padding: 160px 20px 0; - - img { - width: 250px; - display: block; - margin: 0 auto; - } - - p { - text-align: inherit; - } -} - -.two-factor-key-page { - padding: 20px 20px 0 20px; - text-align: center; - - .img-responsive { - margin-left: auto; - margin-right: auto; - } - - p { - text-align: inherit; - } -} - -.bottom-buttons { - position: absolute; - bottom: 0; - width: 100%; - left: 0; - padding: 20px; - - .btn { - font-size: @font-size-base; - } - - .btn-link { - font-weight: 600; - } -} - -.premium-page { - padding: 60px 20px 20px; - position: relative; - height: 100%; - - p.lead { - font-weight: normal; - font-size: 18px; - margin-bottom: 30px; - } - - ul { - margin-bottom: 30px; - } -} - -body.xs { - .premium-page, .home-page, .splash-page { - height: auto; - } - - .home-page { - padding-top: 50px; - } - - .splash-page { - padding-top: 60px; - } - - .premium-page { - padding-top: 20px; - } - - .bottom-buttons { - position: relative; - } -} - -body.sm { - .premium-page { - padding-top: 20px; - - .bottom-buttons { - position: relative; - } - - p.lead { - margin-bottom: 10px; - } - - ul { - margin-bottom: 20px; - } - } -} diff --git a/src/popup-old/less/plugins.less b/src/popup-old/less/plugins.less deleted file mode 100644 index cc80e5a6d2..0000000000 --- a/src/popup-old/less/plugins.less +++ /dev/null @@ -1,138 +0,0 @@ -@import (reference) "variables.less"; - -/* Toastr */ - -#toast-container { - &.toast-bottom-center .toast { - width: 100%; - margin-bottom: 0; - margin-top: 6px; - } - - .toast { - opacity: 1 !important; - background-image: none !important; - border-radius: 0; - .box-shadow(0 0 8px rgba(0, 0, 0, 0.5)); - - &.toast-danger, &.toast-error { - background-image: none !important; - background-color: @brand-danger; - - &:before { - content: "\f0e7"; - } - } - - &.toast-warning { - background-image: none !important; - background-color: @brand-warning; - - &:before { - content: "\f071"; - } - } - - &.toast-info { - background-image: none !important; - background-color: @brand-info; - - &:before { - content: "\f05a"; - } - } - - &.toast-success { - background-image: none !important; - background-color: @brand-success; - - &:before { - content: "\f00C"; - } - } - - &:before { - position: fixed; - font-family: FontAwesome; - font-size: 24px; - line-height: 24px; - float: left; - color: #ffffff; - padding-right: 0.5em; - margin: auto 0.5em auto -1.5em; - } - } -} - -/* Sweet alert */ - -.sweet-alert { - border-radius: 0; - -webkit-border-radius: 0; - -moz-border-radius: 0; - - p { - color: @text-color; - font-weight: normal; - font-size: @font-size-base; - color: @text-color; - } - - h2 { - line-height: 30px; - font-size: 25px; - margin: 0 0 20px 0; - color: @text-color; - } - - .sa-icon.sa-error { - border-color: @brand-danger; - } - - .pulseErrorIns { - background-color: @brand-danger !important; - } - - .sa-icon.sa-info { - border-color: @brand-info; - - &:before, &:after { - background-color: @brand-info; - } - } - - .sa-icon.sa-success { - border-color: @brand-success; - } - - .pulseSuccessIns { - background-color: @brand-success !important; - } - - .sa-icon.sa-warning { - border-color: @brand-warning; - } - - .pulseWarningIns { - background-color: @brand-warning !important; - } - - .sa-button-container { - text-align: inherit; - } - - button { - border-radius: 0; - -webkit-border-radius: 0; - -moz-border-radius: 0; - font-weight: normal; - - &.confirm, &.confirm:hover { - background-color: @brand-primary !important; - } - - &.cancel, &.cancel:hover { - background-color: @gray-light; - } - } -} diff --git a/src/popup-old/less/popup.less b/src/popup-old/less/popup.less deleted file mode 100644 index 9804ee2bc6..0000000000 --- a/src/popup-old/less/popup.less +++ /dev/null @@ -1,65 +0,0 @@ -@import "~bootstrap/less/bootstrap.less"; -@import (less) "~angular/angular-csp.css"; -@import "variables.less"; -@import "mixins.less"; -@import "components.less"; -@import "animations.less"; -@import "plugins.less"; -@import "pages.less"; -@import (less) "../css/webfonts.css"; - -html { - -webkit-font-smoothing: antialiased; -} - -body { - width: 375px !important; - height: 667px !important; - background-color: @background-color; - overflow: hidden; -} - -html.firefox body, -html.edge body { - width: 320px !important; - height: 568px !important; -} - -body.sm { - width: 375px !important; - height: 500px !important; -} - -body.xs { - width: 375px !important; - height: 300px !important; -} - -.main-view { - position: absolute; - width: 100%; - height: 100%; - z-index: 980; -} - -.content { - position: absolute; - top: 44px; - bottom: 0; - left: 0; - right: 0; - overflow: auto; - background-color: @background-color; - - &.content-tabs { - bottom: 55px; - } - - &.content-no-header { - top: 0; - } -} - -.monospaced { - font-family: @font-family-monospace; -} diff --git a/src/popup-old/less/variables.less b/src/popup-old/less/variables.less deleted file mode 100644 index 145ab8acc3..0000000000 --- a/src/popup-old/less/variables.less +++ /dev/null @@ -1,18 +0,0 @@ -@import (reference) "~bootstrap/less/bootstrap.less"; -@import (reference) "~bootstrap/less/mixins.less"; -@import (reference) "~bootstrap/less/variables.less"; - -@font-family-sans-serif: "Open Sans", sans-serif; -@text-color: #000000; -@background-color: #efeff4; -@border-color: #f0f0f0; -@border-color-dark: #ddd; -@list-item-hover: #fbfbfb; -@list-icon-color: #c7c7cd; - -@brand-primary: #3c8dbc; -@brand-danger: #dd4b39; -@brand-success: #00a65a; -@brand-info: #555555; -@brand-warning: #f39c12; -@brand-primary-accent: #286090;