Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #6493 from calavera/enpass_password_manager
Browse files Browse the repository at this point in the history
Add support for Enpass password manager.
  • Loading branch information
bsclifton authored Jan 25, 2017
2 parents 81d906f + ea87980 commit d466cd8
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ module.exports.init = () => {
disableExtension(extensionIds[passwordManagers.LAST_PASS])
}

if (activePasswordManager === passwordManagers.ENPASS) {
registerComponent(extensionIds[passwordManagers.ENPASS])
} else {
disableExtension(extensionIds[passwordManagers.ENPASS])
}

if (getSetting(settings.POCKET_ENABLED)) {
registerComponent(config.PocketExtensionId)
} else {
Expand Down
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/preferences.properties
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ builtInPasswordManager=Brave Built-In
onePassword=1Password® (requires application)
dashlane=Dashlane® (requires application)
lastPass=LastPass®
enpass=Enpass® (requires application)
doNotManageMyPasswords=Don't manage my passwords
usePDFJS=Enable HTML5 PDF reader (requires browser restart)
enableFlash=Enable Adobe Flash support
Expand Down
1 change: 1 addition & 0 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ AppStore
'security.passwords.manager-enabled': boolean, // whether to use default password manager
'security.passwords.one-password-enabled': boolean, // true if the 1Password extension should be enabled
'security.passwords.dashlane-enabled': boolean, // true if the Dashlane extension should be enabled
'security.passwords.enpass-enabled': boolean, // true if the Enpass extension should be enabled
'bookmarks.toolbar.show': boolean, // true if the bookmakrs toolbar should be shown
'bookmarks.toolbar.showFavicon': boolean, // true if bookmark favicons should be shown on the bookmarks toolbar
'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar
Expand Down
1 change: 1 addition & 0 deletions js/about/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -1652,6 +1652,7 @@ class SecurityTab extends ImmutableComponent {
<option data-l10n-id='onePassword' value={passwordManagers.ONE_PASSWORD} />
<option data-l10n-id='dashlane' value={passwordManagers.DASHLANE} />
<option data-l10n-id='lastPass' value={passwordManagers.LAST_PASS} />
<option data-l10n-id='enpass' value={passwordManagers.ENPASS} />
<option data-l10n-id='doNotManageMyPasswords' value={passwordManagers.UNMANAGED} />
</SettingDropdown>
</SettingItem>
Expand Down
1 change: 1 addition & 0 deletions js/constants/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ module.exports = {
'security.passwords.one-password-enabled': false,
'security.passwords.dashlane-enabled': false,
'security.passwords.last-pass-enabled': false,
'security.passwords.enpass-enabled': false,
'security.flash.installed': false,
'general.downloads.default-save-path': null,
'general.disable-title-mode': process.platform === 'linux',
Expand Down
3 changes: 3 additions & 0 deletions js/constants/passwordManagers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const passwordManagers = {
ONE_PASSWORD: '1Password',
DASHLANE: 'Dashlane',
LAST_PASS: 'LastPass',
ENPASS: 'Enpass',
UNMANAGED: 'Unmanaged'
}

Expand All @@ -17,13 +18,15 @@ extensionIds[passwordManagers.BUILT_IN] = null
extensionIds[passwordManagers.ONE_PASSWORD] = 'aomjjhallfgjeglblehebfpbcfeobpgk'
extensionIds[passwordManagers.DASHLANE] = 'fdjamakpfbbddfjaooikfcpapjohcfmg'
extensionIds[passwordManagers.LAST_PASS] = 'hdokiejnpimakedhajhdlcegeplioahd'
extensionIds[passwordManagers.ENPASS] = 'kmcfomidfpdkfieipokbalgegidffkal'
extensionIds[passwordManagers.UNMANAGED] = null

let displayNames = {}
displayNames[passwordManagers.BUILT_IN] = null
displayNames[passwordManagers.ONE_PASSWORD] = '1Password'
displayNames[passwordManagers.DASHLANE] = 'Dashlane'
displayNames[passwordManagers.LAST_PASS] = 'LastPass'
displayNames[passwordManagers.ENPASS] = 'Enpass'
displayNames[passwordManagers.UNMANAGED] = null

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions js/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const settings = {
ONE_PASSWORD_ENABLED: 'security.passwords.one-password-enabled',
DASHLANE_ENABLED: 'security.passwords.dashlane-enabled',
LAST_PASS_ENABLED: 'security.passwords.last-pass-enabled',
ENPASS_ENABLED: 'security.passwords.enpass-enabled',
// > phased out with 0.12.6
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
Expand Down
3 changes: 3 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const passwordManagerDefault = (settingKey, settingsCollection) => {
const lastPassEnabled = resolveValue(settings.LAST_PASS_ENABLED, settingsCollection) === true
if (lastPassEnabled) return passwordManagers.LAST_PASS

const enpassEnabled = resolveValue(settings.ENPASS_ENABLED, settingsCollection) === true
if (enpassEnabled) return passwordManagers.ENPASS

const disabled = resolveValue(settings.PASSWORD_MANAGER_ENABLED, settingsCollection) === false
if (disabled) return passwordManagers.UNMANAGED

Expand Down
14 changes: 14 additions & 0 deletions test/about/extensionsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,18 @@ describe('about:extensions', function () {
.waitForVisible(`[data-extension-id="${extensionIds[passwordManagers.LAST_PASS]}"]`, extensionDownloadWaitTime)
})
})
describe('Enpass installs when enabled', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
})
it('installs', function * () {
yield this.app.client
.windowByUrl(Brave.browserWindowUrl)
.changeSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, passwordManagers.ENPASS)
.waitForVisible(`.extensionBrowserAction[data-button-value="${extensionIds[passwordManagers.ENPASS]}"]`)
.tabByIndex(0)
.waitForVisible(`[data-extension-id="${extensionIds[passwordManagers.ENPASS]}"]`, extensionDownloadWaitTime)
})
})
})
14 changes: 13 additions & 1 deletion test/unit/settingsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,19 @@ describe('settings unit test', function () {
assert.equal(response, passwordManagers.LAST_PASS)
})

it('returns `Enpass` if ENPASS_ENABLED was true', function () {
settingsCollection[settingsConst.ENPASS_ENABLED] = true
const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
assert.equal(response, passwordManagers.ENPASS)
})

it('returns `BuiltIn` if PASSWORD_MANAGER_ENABLED was true', function () {
settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
const response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
assert.equal(response, passwordManagers.BUILT_IN)
})

it('returns `1Password`/`Dashlane`/`LastPass`, even if PASSWORD_MANAGER_ENABLED was true', function () {
it('returns `1Password`/`Dashlane`/`LastPass`/`Enpass`, even if PASSWORD_MANAGER_ENABLED was true', function () {
// 1Password
settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true
settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
Expand All @@ -100,6 +106,12 @@ describe('settings unit test', function () {
settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
assert.equal(response, passwordManagers.LAST_PASS)
// Enpass
settingsCollection = {}
settingsCollection[settingsConst.ENPASS_ENABLED] = true
settingsCollection[settingsConst.PASSWORD_MANAGER_ENABLED] = true
response = settings.getSetting(settingsConst.ACTIVE_PASSWORD_MANAGER, settingsCollection)
assert.equal(response, passwordManagers.ENPASS)
})

it('returns `Unmanaged` if PASSWORD_MANAGER_ENABLED was false', function () {
Expand Down

0 comments on commit d466cd8

Please sign in to comment.