-
-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bitwarden): added field for server url during setup for self-hosted servers and others #2246
base: master
Are you sure you want to change the base?
feat(bitwarden): added field for server url during setup for self-hosted servers and others #2246
Conversation
6cf9e16
to
2790375
Compare
This seems reasonable from reading over it; can you explain "fixed confusing cache logic that does not cache credential request responses properly"? |
@PalmerAL In the original code, the cache list min/js/passwordManager/bitwarden.js Line 87 in 5bd1544
|
@PalmerAL Thanks for bringing us multi-window support. |
…ted servers fix(bitwarden): fixed confusing cache logic that does not cache credential request responses properly refactor(prompt): retrofitted the `createPrompt` function with promise refactor(prompt): updated `createPrompt` usage for the promise retrofit refactor: unwrapped AutofillSetup as individual functions and exported the `initialize` function that is used externally refactor: unwrapped PasswordManagers as individual functions and exported functions that are used externally refactor: replaced some usages of `var` with `let` and `const`
…e now thrown directly fix(passwordCapture): renamed typo `handleRecieveCredentials` to `handleReceivedCredentials` and updated usage refactor(passwordCapture): updated error handling for `getSuggestions` in `handleReceivedCredentials`
105c09d
to
317ab4d
Compare
…in the event handler for `show-prompt`
@PalmerAL Sorry to ping. Conflict resolved now. |
Sorry, I haven't had time to test this. Will do in the next few days. |
@PalmerAL Sorry my fault. Please take your time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good other than comments! I couldn't find a custom server to test this with (and didn't want to spend the time setting one up), but everything seems to work with the default server.
var signInFields = [ | ||
// show ask-for-credential dialog | ||
const signInFields = [ | ||
{ placeholder: 'Server URL (Leave blank for the default Bitwarden server)', id: 'url', type: 'text' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be a translated string - add it to en-US.json
, then do l(stringName)
like the examples below.
Actually, maybe "client ID" and "Client Secret" should be translated also, although I think the reason not to translate them was so that it would be clear in Bitwarden what we're referring to.
ok: l('dialogConfirmButton'), | ||
cancel: l('dialogSkipButton'), | ||
width: 500, | ||
height: 260 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var formattedHostname = hostname | ||
if (formattedHostname.startsWith('www.')) { | ||
formattedHostname = formattedHostname.slice(4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks autofill on sites starting with www.
, because we pass hostname
in the autofill response, and it then makes this check fail:
min/js/preload/passwordFill.js
Lines 273 to 275 in 323e5df
if (data.hostname !== window.location.hostname) { | |
throw new Error('password origin must match current page origin') | |
} |
(We should keep the check, it's guarding against us accidentally sending IPC messages to the wrong tab)
BW_CLIENTID: credentials.clientID.trim(), | ||
BW_CLIENTSECRET: credentials.clientSecret.trim() | ||
}) | ||
credentials.url = credentials.url || 'bitwarden.com' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't clear to me whether I was supposed to type "bitwarden.com" or "vault.bitwarden.com" - do they both work? If not, maybe we should special-case this so if the user enters one we convert to the other.
feat(bitwarden): added field for server url during setup for self-hosted servers
fix(bitwarden): fixed confusing cache logic that does not cache credential request responses properly
refactor(prompt): retrofitted the
createPrompt
function with promiserefactor(prompt): updated
createPrompt
usage for the promise retrofitrefactor: unwrapped AutofillSetup as individual functions and exported the
initialize
function that is used externallyrefactor: unwrapped PasswordManagers as individual functions and exported functions that are used externally
refactor: replaced some usages of
var
withlet
andconst