Skip to content

Commit 26c2f72

Browse files
committed
1password: check for integration prompt and disable it
#2151
1 parent ff1a185 commit 26c2f72

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

js/passwordManager/onePassword.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,29 @@ class OnePassword {
8282
return compareVersions('2.2.0', data) >= 0
8383
}
8484

85+
async _completeIntegrationPrompt (command) {
86+
try {
87+
const process = new ProcessSpawner(command, ['whoami'], {}, 1000)
88+
await process.executeSyncInAsyncContext()
89+
} catch (e) {
90+
if (e.toString().includes('Would you like to turn on the 1Password app integration?')) {
91+
console.warn('disabling 1password app integration')
92+
try {
93+
const retryProcess = new ProcessSpawner(command, ['whoami'], {}, 1000)
94+
await retryProcess.executeSyncInAsyncContext('n\n')
95+
} catch (e) {
96+
console.warn(e)
97+
}
98+
}
99+
}
100+
return true
101+
}
102+
85103
// Checks if 1Password integration is configured properly by trying to
86104
// obtain a valid 1Password-CLI tool path.
87105
async checkIfConfigured () {
88106
this.path = await this._getToolPath()
89-
return this.path != null && (await this._checkVersion(this.path))
107+
return this.path != null && (await this._checkVersion(this.path)) && (await this._completeIntegrationPrompt(this.path))
90108
}
91109

92110
// Returns current 1Password-CLI status. If we have a session key, then

0 commit comments

Comments
 (0)